Message46513
this patch applies to anonymous CVS as of 2004-08-02 at 07:
54:58 PDT.
it adds O(1) membership testing; for example:
Python 2.4a1+ (#2, Aug 2 2004, 09:11:43)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on
darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>> import sys
>>> sys.maxint
2147483647
>>> sys.maxint in xrange(sys.maxint)
False
in current CVS, this would take untold hours to complete
(because Python arrives at this answer by iterating on the
sequence). this patch adds a __contains__ method to the
xrange object which examines the xrange's pattern and
determines the correct answer instantly based on that pattern. |
|
Date |
User |
Action |
Args |
2007-08-23 15:39:01 | admin | link | issue1002085 messages |
2007-08-23 15:39:01 | admin | create | |
|