<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 4, 2013 at 8:13 AM, Chris Withers <span dir="ltr"><<a href="mailto:chris@simplistix.co.uk" target="_blank">chris@simplistix.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 04/07/2013 12:59, Christian Heimes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am 04.07.2013 13:21, schrieb Chris Withers:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
There doesn't appear to be any way in Python 3 to do this, which is a<br>
little surprising and frustrating...<br>
<br>
What am I missing here?<br>
</blockquote>
<br>
I removed unbound methods almost six years ago:<br>
<br>
<a href="http://hg.python.org/cpython/rev/48af6375207e" target="_blank">http://hg.python.org/cpython/<u></u>rev/48af6375207e</a><br>
</blockquote>
<br></div>
Not disputing when it happened, more the why...<br>
<br>
...the recommended change doesn't work, for obvious reasons:<br>
<br>
>>> MyClass.method.__self__.__<u></u>class__<br>
Traceback (most recent call last):<br>
File "<console>", line 1, in <module><br>
AttributeError: 'function' object has no attribute '__self__'<br>
<br>
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.<br></blockquote><div><br></div><div>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.</div>
</div></div></div>