[Python-ideas] Storages Re: Idea for the mapping API
Guido van Rossum
guido at python.org
Sun Feb 10 20:27:18 CET 2008
On Feb 10, 2008 10:31 AM, Roman Susi <rnd at onego.ru> wrote:
> Raymond Hettinger wrote:
> > Perhaps, the dict() constructor should accept any object with a __dict__ method.
> >
> > The principle is that almost any object that has key and value pairs (named tuples for example) should be readily convertable to and
> > from a dictionary. The current, non-uniform alternative is for the object to provide an asdict() method and for the user to call it
> > directly.
> >
> > Raymond
>
> BTW, will the coming ABC have classes with "setattr ~= setitem"
> functionality?
No-- this will just cause confusion about which API to use. Go use
JavaScript if you want that. :-)
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-ideas
mailing list