Serhiy Storchaka added the comment:
I don't think this is right repr for shelve. As file's repr doesn't read and
expose a content of a file, shelve's repr shouldn't read and expose all
database content.
--
nosy: +serhiy.storchaka
___
Python tracker
Claudiu Popa added the comment:
Fair point, Serhiy. But I see the shelve more similar to a persistent,
dictionary-like object, than to a file. The fact that it uses some database
behind is just an implementation detail.
--
___
Python tracker
Serhiy Storchaka added the comment:
When shelve stores its data on a disk, it is more similar to a file. After all,
it can contain gigabytes of data, much larger than Python can address in RAM.
I you want more readable repr, I with Raymond, -- use the repr of the
underlying db and add
Claudiu Popa added the comment:
Alright, I agree with you now. You can close the issue if you want.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21670
___
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
resolution: - wont fix
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21670
___
Changes by Berker Peksag berker.pek...@gmail.com:
--
stage: patch review - resolved
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21670
___
___
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
assignee: - rhettinger
nosy: +rhettinger
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21670
___
Raymond Hettinger added the comment:
This may not be the right repr for the usual way of creating shelves:
d = shelve.open('tmp.shl')
print(repr(d)) # I would expect the repr to show
# the underlying db instead of all the
Claudiu Popa added the comment:
The problem is that the repr of the underlying db is not very helpful either,
as seen for the dbm backend.
import dbm
dbm.open(test, c)
dbm.dumb._Database object at 0x03091FC0
f=_
f[b2] = ba
f
dbm.dumb._Database object at 0x03091FC0
But it shows the
New submission from Claudiu.Popa:
Hello!
Working with Shelf instances in the interactive console is cumbersome because
you can't have an instant feedback when running the following:
from shelve import Shelf
s = Shelf({})
s['a'] = 1
s
shelve.Shelf object at 0x033D0AF0
This patch adds an
10 matches
Mail list logo