| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
- The copy module now "copies" function objects (as atomic objects).
- dict.__getitem__ now looks for a __missing__ hook before raising
KeyError.
- Added a new type, defaultdict, to the collections module.
This uses the new __missing__ hook behavior added to dict (see above).
|
| |
|
| |
|
|
|
|
| |
http://mail.python.org/pipermail/python-dev/2006-February/060524.html
|
|
|
|
| |
Probably should be backported.
|
| |
|
|
|
|
| |
(fixes bug #1119418)
|
| |
|
| |
|
|
|
|
|
|
|
| |
(Contributed by Dima Dorfman.)
* Support pickling of dictionaries in instances of deque subclasses.
* Support pickling of recursive deques.
|
| |
|
|
|
|
| |
arguments passed through tuples.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
deque_item(): a performance bug: the linked list of blocks was followed
from the left in most cases, because the test (i < (deque->len >> 1)) was
after "i %= BLOCKLEN".
deque_clear(): replaced a call to deque_len() with deque->len; not sure what
this call was here for, nor if all compilers under the sun would inline it.
deque_traverse(): I belive that it could be called by the GC when the deque
has leftblock==rightblock==NULL, because it is tracked before the first block
is allocated (though closely before). Still, a C extension module subclassing
deque could provide its own tp_alloc that could trigger a GC collection after
the PyObject_GC_Track()...
deque_richcompare(): rewrote to cleanly check for end-of-iterations instead of
relying on deque.__iter__().next() to succeed exactly len(deque) times -- an
assumption which can break if deques are subclassed. Added a test.
I wonder if the length should be explicitely bounded to INT_MAX, with
OverflowErrors, as in listobject.c. On 64-bit machines, adding more than
INT_MAX in the deque will result in trouble. (Note to anyone/me fixing
this: carefully check for overflows if len is close to INT_MAX in the
following functions: deque_rotate(), deque_item(), deque_ass_item())
|
|
|
|
|
|
|
|
|
| |
The previous approach was too easily fooled (a rotate() sufficed).
* Use it->counter to determine when iteration is complete. The
previous approach was too complex.
* Strengthen an assertion and add a comment here or there.
|
| |
|
| |
|
|
|
|
|
|
| |
* Change the centering by one to make it possible to test the module
with BLOCKLEN's as low as two. Testing small blocks makes end-point
errors surface more readily.
|
|
|
|
|
| |
BLOCKLEN-1, this assert-failed in a debug build, or went wild with a
NULL pointer in a release build. Reported on c.l.py by Stefan Behnel.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
modules and objects.
|
|
|
|
|
| |
* use assertions instead of tests after internal calls that can't fail.
* expand test coverage
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
same method that implements __setitem__ also implements __delitem__.
Also, there were several good use cases (removing items from a queue
and implementing Forth style stack ops).
|
|
|
|
|
|
| |
* Document the differences between them
* Fix corner cases covered by the unittests
* Use Py_RETURN_NONE where possible for dictionaries
|
|
|
|
|
|
| |
* The default __reversed__ performed badly, so reintroduced a custom
reverse iterator.
* Added length transparency to improve speed with map(), list(), etc.
|
| |
|
|
|
|
|
|
|
| |
__getitem__() and __setitem__().
Simplifies the API, reduces the code size, adds flexibility, and makes
deques work with bisect.bisect(), random.shuffle(), and random.sample().
|
| |
|
|
|
|
|
|
|
|
| |
* Add doctests for the examples in the library reference.
* Add two methods, left() and right(), modeled after deques in C++ STL.
* Apply the new method to asynchat.py.
* Add comparison operators to make deques more substitutable for lists.
* Replace the LookupErrors with IndexErrors to more closely match lists.
|
| |
|
| |
|
|
|
|
|
| |
comes from and show the differences from lists).
* Add a rotate() method.
|
|
|
|
| |
* Let deques support reversed().
|
| |
|
| |
|
|
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
|