[Python-ideas] Idea for the mapping API
ryan.freckleton at gmail.com
Sun Feb 10 03:41:27 CET 2008
I'd rather have the dict built-in function be a dynamically
over-loadable (generic) function. I think it's a better fit than
adding another __special__ method. The same technique could be used
for the other built-in types and user created classes.
Somewhat similar to Eiffel, actually...
On Feb 9, 2008 6:22 PM, Raymond Hettinger <python at rcn.com> 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
> Python-ideas mailing list
> Python-ideas at python.org
--Ryan E. Freckleton
More information about the Python-ideas