[Tutor] cannot save changes to dictionary in a shelve file

Magnus Lycka magnus@thinkware.se
Thu, 17 Oct 2002 01:28:45 +0200


At 23:27 2002-10-16 +0200, Kalle Svensson wrote:
>Try adding 'db["projects"] =3D projects' before 'db.close()'.

So 'projects =3D db[projects]' creates a copy, not a
reference? That's not very pythonic, is it?

It's not so strange that it behaves like this, if
one thinks about the underlying mechanics. But it
is a deviation from the norm that a =3D b suddenly
means copy an object, not make a new reference to
an object. This should be documented in a clearer
way I think.

I must say that I find the docs for this module very
thin... Basically just a very simple usage example.


--=20
Magnus Lyck=E5, Thinkware AB
=C4lvans v=E4g 99, SE-907 50 UME=C5
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se