Message215561
d[key] += 1 still does two dict lookups, and invokes the hash function twice:
>>> class X(object):
... def __hash__(self):
... print "hashed"
... return 0
... def __eq__(self, other):
... return True
...
>>> d = {X(): 0}
hashed
>>> d[X()]
hashed
0
>>> d[X()] = 3
hashed
>>> d[X()] += 1
hashed
hashed |
|
Date |
User |
Action |
Args |
2014-04-04 20:31:19 | alex | set | recipients:
+ alex, rhettinger, terry.reedy, pitrou, Arfrever, serhiy.storchaka, josh.r |
2014-04-04 20:31:19 | alex | set | messageid: <1396643479.2.0.911075269516.issue21101@psf.upfronthosting.co.za> |
2014-04-04 20:31:19 | alex | link | issue21101 messages |
2014-04-04 20:31:19 | alex | create | |
|