New submission from Skip Montanaro <[EMAIL PROTECTED]>: 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. ---------- messages: 72711 nosy: skip.montanaro priority: high severity: normal status: open title: Byte/string inconsistencies between different dbm modules type: behavior versions: Python 3.0 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3799> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com