Re: Observations about instances, types and dbm

Jack Jansen (Jack.Jansen@cwi.nl)
Tue, 11 Aug 1992 11:46:28 +0200

Recently, Jaap Vermeulen <jaap@sequent.com> said:

This one is for Jack: I was using the dbm module and am a little
disappointed that it only takes strings as data (although I shouldn't look
a gift horse in the mouth :-). I was wondering how much effort it would
be to support all data types that are supported by the module 'marshal'?

Hmm, I'm not too sure about this. An ideal solution would be if you
could write a wrapper in python to do this, but that is currently
impossible. Guido, would it be possible to extend python to allow you
to declare classes that mimic builtin types? I can envision a model
whereby the builtin class Mapping() defines methods get(index) and
put(index, value), and where I can then define a class that inherits
Mapping() and redefines get() and put(). The parser should then
translate 'foo[expr]' into 'foo.get(expr)' and that's that.

But then, I'm probably seeing things in a far too simple way...

--
Jack Jansen        | If I can't dance I don't want to be part of
Jack.Jansen@cwi.nl | your revolution             -- Emma Goldman
uunet!cwi.nl!jack    G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl