On Thu, Jul 4, 2013 at 8:13 AM, Chris Withers <ch...@simplistix.co.uk>wrote:

> On 04/07/2013 12:59, Christian Heimes wrote:
>
>> Am 04.07.2013 13:21, schrieb Chris Withers:
>>
>>> There doesn't appear to be any way in Python 3 to do this, which is a
>>> little surprising and frustrating...
>>>
>>> What am I missing here?
>>>
>>
>> I removed unbound methods almost six years ago:
>>
>> http://hg.python.org/cpython/**rev/48af6375207e<http://hg.python.org/cpython/rev/48af6375207e>
>>
>
> Not disputing when it happened, more the why...
>
> ...the recommended change doesn't work, for obvious reasons:
>
> >>> MyClass.method.__self__.__**class__
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
> AttributeError: 'function' object has no attribute '__self__'
>
> The loss of the ability to figure out the class from an unbound method
> seems quite an annoying step back from an introspection point of view.
>

It's only annoying if you take the perspective that methods are somehow
special compared to functions. With the removal of bound class methods that
makes methods == functions that are an attribute on a class. And when you
take that perspective it makes having anything special about methods seem
wrong. It also makes adding a function to a class post-class creation make
more sense since there is no difference technically.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to