Attack a sacred Python Cow

Nikolaus Rath Nikolaus at
Mon Jul 28 09:35:16 CEST 2008

Michael Torrie <torriem at> writes:
> Colin J. Williams wrote:
>>>     def fun( ., cat):
>> I don't see the need for the comma in fun.
> It (the entire first variable!) is needed because a method object is
> constructed from a normal function object:
> def method(self,a,b):
> 	pass
> class MyClass(object):
> 	pass
> MyClass.testmethod=method
> That's precisely the same as if you'd defined method inside of the class
> to begin with.  A function becomes a method when the lookup procedure in
> the instance object looks up the attribute and returns (from what I
> understand) essentially a closure that binds the instance to the first
> variable of the function.  The result is known as a bound method, which
> is a callable object:
>>>> instance=MyClass()
>>>> instance.testmethod
> <bound method MyClass.testmethod of <__main__.instance object at xxx>>
> How would this work if there was not first parameter at all?
> In short, unlike what most of the implicit self advocates are
> saying, it's not just a simple change to the python parser to do
> this. It would require a change in the interpreter itself and how it
> deals with classes.

Thats true. But out of curiosity: why is changing the interpreter such
a bad thing? (If we suppose for now that the change itself is a good



 »It is not worth an intelligent man's time to be in the majority.
  By definition, there are already enough people to do that.«
                                                         -J.H. Hardy

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

More information about the Python-list mailing list