Message72711
Consider these two timeit commands:
py3k% python3.0 -m timeit -s 'import dbm.ndbm as db' -s 'f =
db.open("/tmp/trash.db", "c")' 'for i in range(1000): f[str(i)] = str(i)'
100 loops, best of 3: 5.51 msec per loop
py3k% python3.0 -m timeit -s 'import dbm.dumb as db' -s 'f =
db.open("/tmp/trash.db", "c")' 'for i in range(1000): f[str(i)] = str(i)'
Traceback (most recent call last):
File "/Users/skip/local/lib/python3.0/timeit.py", line 297, in main
x = t.timeit(number)
File "/Users/skip/local/lib/python3.0/timeit.py", line 193, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 7, in inner
for i in range(1000): f[str(i)] = str(i)
File "/Users/skip/local/lib/python3.0/dbm/dumb.py", line 165, in
__setitem__
raise TypeError("keys must be bytes")
TypeError: keys must be bytes
Seems to me they should either both succeed or both fail. What are keys
and values supposed to be for these modules?
Marking it as high priority. When 3.0 is released all these modules
should probably agree. |
|
Date |
User |
Action |
Args |
2008-09-06 21:59:32 | skip.montanaro | set | recipients:
+ skip.montanaro |
2008-09-06 21:59:32 | skip.montanaro | set | messageid: <1220738372.55.0.492476136204.issue3799@psf.upfronthosting.co.za> |
2008-09-06 21:59:31 | skip.montanaro | link | issue3799 messages |
2008-09-06 21:59:31 | skip.montanaro | create | |
|