summaryrefslogtreecommitdiff
path: root/Objects/dictobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Correct Barry's fix -- take care of {}.get(0).Guido van Rossum1997-10-201-0/+3
|
* dict_get(): Fixed a couple of stupid mistakes which caused crashes.Barry Warsaw1997-10-201-8/+2
| | | | Also got rid of some unnecessary code.
* dict_get(): New method for item access with different semantics thanBarry Warsaw1997-10-061-0/+38
| | | | | | | | | __getitem__(). This method never raises an exception; if the key is not in the dictionary, the second (optional) argument is returned. If the second argument is not provided and the key is missing, None is returned. mapp_methods: added "get" method.
* Don't intern the key string for getitem and delitem.Guido van Rossum1997-09-291-3/+1
|
* Made lookdict nearly twice as fast, resulting in a 5% overallGuido van Rossum1997-08-181-11/+13
| | | | improvement of pystone. Vladimir Marangozov.
* Reordered list of methods to hopefully put the most frequently usedGuido van Rossum1997-07-131-4/+4
| | | | ones near the front.
* Renamed dict.absorb() (too spungy) to dict.update().Guido van Rossum1997-06-021-3/+3
|
* Added dict.absorb() and dict.copy().Guido van Rossum1997-05-281-6/+70
|
* PyObject_Compare can now return an error. Unfortunately, there are aGuido van Rossum1997-05-231-0/+8
| | | | | few places where we don't know how to test for them without losing speed; don't know yet how to handle that.
* Moved PyObject_{Get,Set}Attr to object.c.Guido van Rossum1997-05-201-33/+2
| | | | Fixed two 'return NULL' that should be 'return -1'.
* Got rid of all the last_name_* bogosities. I don't think theGuido van Rossum1997-05-161-53/+34
| | | | | | | complexity saved much any more. A simple benchmark (grail) showed that there were 3 times as many misses as hits, and the same number of times again the code was bypassed altogether due to the existence of setattro/getattro.
* Renamed from mappingobject.c to dictobject.c.Guido van Rossum1997-05-131-110/+104
| | | | (Sorry Jack, all your projects will have to be changed again. :-( )
* Quickly renamed the last directory.Guido van Rossum1997-05-021-255/+258
|
* (Jack:) Align mapping entries to 4-words if USE_CACHE_ALIGNED is defined.Guido van Rossum1997-04-111-0/+3
|
* Tweaks to keep the Microsoft compiler quiet.Guido van Rossum1997-04-091-1/+1
|
* Add clear() method to dictionary objects.Guido van Rossum1997-03-211-0/+13
|
* Small lookmapping nits:Guido van Rossum1997-01-291-5/+6
| | | | | | - remove bogus initialization using uninitialized i - derive initial incr from hash - copy mp->ma_table into a local variable
* Final three poly table entries corrected by Tim Peters.Guido van Rossum1997-01-291-31/+30
| | | | Reindented the whole table.
* Changed the lookup algorithm again, based on Reimer Behrends's post.Guido van Rossum1997-01-281-114/+101
| | | | | | | | | The table size is now constrained to be a power of two, and we use a variable increment based on GF(2^n)-{0} (not that I have the faintest idea what that is :-) which helps avoid the expensive '%' operation. Some of the entries in the table of polynomials have been modified according to a post by Tim Peters.
* Forget keeping track of whether a dictionary contains all internedGuido van Rossum1997-01-231-89/+55
| | | | | string keys. Just doing a pointer compare before the string compare (in fact before the hash compare!) is just as fast.
* String interning.Guido van Rossum1997-01-181-16/+105
|
* Rewrote lookmapping() according to suggestions by Jyrki Alakuijala.Guido van Rossum1997-01-161-21/+71
|
* Experimental new implementation of dictionary comparison. ThisGuido van Rossum1996-12-051-0/+63
| | | | | | | defines that a shorter dictionary is always smaller than a longer one. For dictionaries of the same size, the smallest differing element determines the outcome (which yields the same results as before, without explicit sorting).
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Support for tp_getattro, tp_setattro (Sjoerd)Guido van Rossum1996-08-091-0/+6
|
* Speedup suggested by SjoerdGuido van Rossum1996-07-301-3/+4
|
* fix free memory reads in dictlookup et alGuido van Rossum1995-12-081-10/+7
|
* a few peephole optimizationsGuido van Rossum1995-03-091-1/+1
|
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
| | | | | floatobject.c: fix hash(). methodobject.c: support METH_FREENAME flag bit.
* * Objects/mappingobject.c (mappingremove): don't callGuido van Rossum1995-01-021-0/+3
| | | | lookmapping() for empty dictionary
* Lots of minor changes. Note for mappingobject.c: the hash table pointerGuido van Rossum1995-01-021-27/+45
| | | | can now be NULL.
* Merge back to main trunkGuido van Rossum1994-08-301-33/+36
|
* Fix lay-out of previous fix.Guido van Rossum1993-11-231-2/+4
|
* * timemodule.c: Add hack for Solaris 2.Guido van Rossum1993-11-231-4/+5
| | | | | | | | | | | | | | | * posixmodule.c: don't prototype getcwd() -- it's not portable... * mappingobject.c: double-check validity of last_name_char in dict{lookup,insert,remove}. * arraymodule.c: need memmove only for non-STDC Suns. * Makefile: comment out HTML_LIBS and XT_USE by default * pythonmain.c: don't prototype getopt() -- it's not standardized * socketmodule.c: cast flags arg to {get,set}sockopt() and addrbuf arg to recvfrom() to (ANY*). * pythonrun.c (initsigs): fix prototype, make it static * intobject.c (LONG_BIT): only #define it if not already defined * classobject.[ch]: remove all references to unused instance_convert() * mappingobject.c (getmappingsize): Don't return NULL in int function.
* * parsermodule.c, Makefile, config.c: rudimentary interface to the PythonGuido van Rossum1993-11-101-1/+1
| | | | | | parser. * mappingobject.c (lookmapping): 'freeslot' was never used due to a bug in the code.
* * posixmodule.c: added set{uid,gid}.Guido van Rossum1993-11-101-2/+2
| | | | | | * {tuple,list,mapping,array}object.c: call printobject with 0 for flags * compile.c (parsestr): use quote instead of '\'' at one crucial point * arraymodule.c (array_getattr): Added __members__ attribute
* Added getmappingsize(). (Needed by previous checkin of posixmodule.c)Guido van Rossum1993-11-051-0/+11
|
* Several optimizations and speed improvements.Sjoerd Mullender1993-10-221-1/+23
| | | | cstubs: Use Matrix type instead of float[4][4].
* Minor fixes / changes for Mac compatibility.Guido van Rossum1993-07-291-2/+2
|
* Several changes in one:Guido van Rossum1993-05-191-37/+115
| | | | | | | | | | | | | | | | (1) dictionaries/mappings now have attributes values() and items() as well as keys(); at the C level, use the new function mappinggetnext() to iterate over a dictionary. (2) "class C(): ..." is now illegal; you must write "class C: ...". (3) Class objects now know their own name (finally!); and minor improvements to the way how classes, functions and methods are represented as strings. (4) Added an "access" statement and semantics. (This is still experimental -- as long as you don't use the keyword 'access' nothing should be changed.)
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+7
| | | | | | | | | | | | | | | | | * Stubs for faster implementation of local variables (not yet finished) * Added function name to code object. Print it for code and function objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version number has changed accordingly) * Print address of self for built-in methods * New internal functions getattro and setattro (getattr/setattr with string object arg) * Replaced "dictobject" with more powerful "mappingobject" * New per-type functio tp_hash to implement arbitrary object hashing, and hashobject() to interface to it * Added built-in functions hash(v) and hasattr(v, 'name') * classobject: made some functions static that accidentally weren't; added __hash__ special instance method to implement hash() * Added proper comparison for built-in methods and functions
* Generalized version of dictionaries, with compatibility hacks.Guido van Rossum1993-03-271-0/+705