Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6835
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.x-privat.org!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!not-for-mail |
|---|---|
| From | Chris Torek <nospam@torek.net> |
| Newsgroups | comp.lang.python |
| Subject | Re: Unshelving the data? |
| Date | 2 Jun 2011 03:24:27 GMT |
| Organization | None of the Above |
| Lines | 28 |
| Message-ID | <is6vpb0hds@news3.newsguy.com> (permalink) |
| References | <4433955b-7f54-400a-af08-1f58a75e734c@j31g2000yqe.googlegroups.com> |
| NNTP-Posting-Host | p6de0f8403017f52d0d8f9433162c1becca3835248f9e60ba.newsdawg.com |
| X-Newsreader | trn 4.0-test76 (Apr 2, 2001) |
| Originator | torek@elf.torek.net (Chris Torek) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6835 |
Show key headers only | View raw
In article <4433955b-7f54-400a-af08-1f58a75e734c@j31g2000yqe.googlegroups.com>
Uncle Ben <bgreen@nycap.rr.com> wrote:
>Shelving is a wonderfully simple way to get keyed access to a store of
>items. I'd like to maintain this cache though.
>
>Is there any way to remove a shelved key once it is hashed into the
>system?
$ pydoc shelve
...
To summarize the interface (key is a string, data is an arbitrary
object):
...
d[key] = data # store data at key (overwrites old data if
# using an existing key)
data = d[key] # retrieve a COPY of the data at key (raise
# KeyError if no such key) -- NOTE that this
# access returns a *copy* of the entry!
del d[key] # delete data stored at key (raises KeyError
# if no such key)
...
Seems pretty straightforward. :-) Are you having some sort
of problem with "del"?
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: gmail (figure it out) http://web.torek.net/torek/index.html
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unshelving the data? Uncle Ben <bgreen@nycap.rr.com> - 2011-06-01 19:49 -0700
Re: Unshelving the data? Chris Torek <nospam@torek.net> - 2011-06-02 03:24 +0000
Re: Unshelving the data? Ben Finney <ben+python@benfinney.id.au> - 2011-06-02 13:25 +1000
Re: Unshelving the data? Adam Tauno Williams <awilliam@whitemice.org> - 2011-06-02 06:46 -0400
Re: Unshelving the data? Uncle Ben <bgreen@nycap.rr.com> - 2011-06-02 06:17 -0700
csiph-web