Python wrapper for C++ STL?
Andrew Dalke
dalke at acm.org
Fri Dec 8 22:47:34 EST 2000
Rainer Deyke wrote
>I tend to use a dictionary where all values are None for sets.
For a bit more performance, use a number, like 0 or 1.
Using None requires a name lookup.
>>> def check_none(r):
... for c in r:
... None == None
...
>>> def check_one(r):
... for c in r:
... 1 == 1
...
>>> import time
>>> r = range(1000000)
>>> t1=time.time();check_none(r);t2=time.time()
>>> t2-t1
6.01800501347
>>> t1=time.time();check_one(r);t2=time.time()
>>> t2-t1
2.72878599167
>>>
Andrew
More information about the Python-list
mailing list