This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients skip.montanaro
Date 2008-09-06.21:59:31
SpamBayes Score 6.1759742e-06
Marked as misclassified No
Message-id <1220738372.55.0.492476136204.issue3799@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-09-06 21:59:32skip.montanarosetrecipients: + skip.montanaro
2008-09-06 21:59:32skip.montanarosetmessageid: <1220738372.55.0.492476136204.issue3799@psf.upfronthosting.co.za>
2008-09-06 21:59:31skip.montanarolinkissue3799 messages
2008-09-06 21:59:31skip.montanarocreate