[Python-Dev] [python] Should we do away with unbound methods in Py3k?

Guido van Rossum guido at python.org
Thu Nov 22 04:16:27 CET 2007


On Nov 21, 2007 4:25 PM, Steven Bethard <steven.bethard at gmail.com> wrote:
> Though I'd like to know what happens when I do something like::
>
>     >>> class C(object):
>     ...     def __setitem__(self, key, value):
>     ...         print key, value
>     ...
>     >>> c = C()
>     >>> dict.update(c, foo='bar')
>     Traceback (most recent call last):
>       File "<interactive input>", line 1, in <module>
>     TypeError: descriptor 'update' requires a 'dict' object but received a 'C'
>
> I assume the code will fail (though it would be really cool if it
> didn't). How will it fail?

I expect it won't change -- built-in types use a different mechanism.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list