[Tutor] using shelve
Reed O'Brien
reed at reedobrien.com
Fri Jun 22 06:26:17 CEST 2007
On Jun 21, 2007, at 9:59 PM, chrispython at mac.com wrote:
> I created a shelf called 'myshelf' and put two objects in it, a
> string and a list. When I open the shelf I get:
>
>>>> d=shelve.open('/Users/development/Desktop/myshelf')
>>>> d.keys()
> ['dir1', 'dir2']
>>>> d
> {'dir2': '/Users/development/Desktop/RSSReaderApp/RSS.db', 'dir1':
> ['.DS_Store', '.localized', 'access the latest version', 'Python
> Quick Reference.webloc', 'rssdb', 'workspace']}
>
> It seems that when you use shelve.open(), it actually brings the
> entire shelf dictionary into memory, accessible through d.
>
> What if you had 100 objects in myshelf, or 1000 or 100,000?
> Wouldn't it get bogged down?
>
> If so, what is it good for and how would you store a large number
> of objects? (Storing strings and lists in an sql database is
> probably the way to go for this simple example, but what if you
> had more complex objects?)
>
> Thanks
> Chris V.
>
>
>
have a gander at:
http://codeidol.com/python/python3/Databases-and-Persistence/
As well as the shelve docs.
~r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070622/80001038/attachment.html
More information about the Tutor
mailing list