[Python-ideas] Idea for the mapping API

Ryan Freckleton 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
> directly.
>
>
> Raymond
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
=====
--Ryan E. Freckleton



More information about the Python-ideas mailing list