summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Moved SunPro warning suppression into pyport.h and out of individualNicholas Bastin2004-07-151-4/+0
| | | | modules and objects.
* Fixed end-of-loop code not reached warning when using SunPro CNicholas Bastin2004-06-171-0/+4
|
* Remove a function no longer in use.Raymond Hettinger2004-06-141-8/+0
|
* Remove unnecessary GC support. Sets cannot have cycles.Raymond Hettinger2004-06-131-16/+7
|
* Futher improvements to frozenset hashing (based on Yitz Gale's battery ofRaymond Hettinger2004-06-101-8/+10
| | | | | | | | | | | | | tests which nicely highly highlight weaknesses). * Initial value is now a large prime. * Pre-multiply by the set length to add one more basis of differentiation. * Work a bit harder inside the loop to scatter bits from sources that may have closely spaced hash values. All of this is necessary to make up for keep the hash function commutative. Fortunately, the hash value is cached so the call to frozenset_hash() will only occur once per set.
* Fixups to the hash function for frozensets.Raymond Hettinger2004-06-101-1/+4
| | | | | | * Non-zero initial value so that hash(frozenset()) != hash(0). * Final permutation to differentiate nested sets. * Add logic to make sure that -1 is not a possible hash value.
* Make sets and deques weak referencable.Raymond Hettinger2004-05-301-4/+8
|
* The copy module now handles sets directly. The __copy__ methods are noRaymond Hettinger2004-03-081-4/+0
| | | | longer needed.
* * Simplify and speedup logic for tp_print.Raymond Hettinger2003-12-311-15/+29
| | | | * Speed-up intersection whenever PyDict_Next can be used.
* Speedup set.update by using the override mode for PyDict_Merge().Raymond Hettinger2003-12-151-1/+1
|
* Improve algorithm for set.difference when the input is not a set.Raymond Hettinger2003-12-151-43/+43
|
* * Refactor set.__contains__()Raymond Hettinger2003-12-131-21/+10
| | | | | * Use Py_RETURN_NONE everywhere. * Fix-up the firstpass check for the tp_print slot.
* Refactor set.discard() and set.remove().Raymond Hettinger2003-12-131-31/+22
|
* Use dictionary specific looping idiom where possible.Raymond Hettinger2003-12-131-114/+40
| | | | Simplifies and speeds-up the code.
* * Added a new method flag, METH_COEXIST.Raymond Hettinger2003-12-131-0/+26
| | | | | * Used the flag to optimize set.__contains__(), dict.__contains__(), dict.__getitem__(), and list.__getitem__().
* Expose dict_contains() and PyDict_Contains() with is about 10% fasterRaymond Hettinger2003-11-251-9/+9
| | | | | | | than PySequence_Contains() and more clearly applicable to dicts. Apply the new function in setobject.c where __contains__ checking is ubiquitous.
* Factor out more duplicate code.Raymond Hettinger2003-11-241-77/+51
|
* Stop GCC warning about int literal that's so long that it becomes anGuido van Rossum2003-11-241-1/+1
| | | | | unsigned int (on a 32-bit machine), by adding an explicit 'u' to the literal (a prime used to improve the hash function for frozenset).
* * Checkin remaining documentationRaymond Hettinger2003-11-241-137/+148
| | | | | | | * Add more tests * Refactor and neaten the code a bit. * Rename union_update() to update(). * Improve the algorithms (making them a closer to sets.py).
* * Simplify hash function and add test to show effectiveness of the hashRaymond Hettinger2003-11-231-14/+26
| | | | | | | | | | | | | | | function. * Add a better test for deepcopying. * Add tests to show the __init__() function works like it does for list and tuple. Add related test. * Have shallow copies of frozensets return self. Add related test. * Have frozenset(f) return f if f is already a frozenset. Add related test. * Beefed-up some existing tests.
* Extend temporary hashability to remove() and discard().Raymond Hettinger2003-11-221-11/+52
| | | | Brings the functionality back in line with sets.py.
* Allow temporary hashability for the __contains__ test.Raymond Hettinger2003-11-211-1/+17
| | | | (Requested by Alex Martelli.)
* issubset() and issuperset() to work with general iterablesRaymond Hettinger2003-11-211-5/+15
|
* Three minor performance improvements:Raymond Hettinger2003-11-201-12/+41
| | | | | | | | | | * Improve the hash function to increase the chance that distinct sets will have distinct xor'd hash totals. * Use PyDict_Merge where possible (it is faster than an equivalent iter/set pair). * Don't rebuild dictionaries where the input already has one.
* Implement straightforward suggestions from gcc warnings (remove unusedGuido van Rossum2003-11-181-3/+2
| | | | variable, add extra braces).
* Use PySequence_Contains() instead of direct access macro.Raymond Hettinger2003-11-181-11/+5
|
* Various fixups (most suggested by Armin Rigo).Raymond Hettinger2003-11-171-40/+66
|
* Fix output spacing typoRaymond Hettinger2003-11-161-1/+1
|
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-0/+1073
* Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.