noob question: "TypeError" wrong number of args

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Wed May 3 00:27:14 EDT 2006


Ben Finney a écrit :
> Edward Elliott <nobody at 127.0.0.1> writes:
> 
> 
>>Compiler, interpreter, magic-codey-runny-thingy, whatever, at some point
>>something has to translate this source code
>>  def method (self, a, b): something
>>into a function object (or whatever you're calling the runnable code this
>>week).  Call this translator Foo.  Whatever Foo is, it can insert 'self'
>>into the parameter list for method, e.g. when it sees "def method (a,b)" it
>>pretend like it saw "def method (self,a,b)" and proceed as usual.  Once it
>>does that, everything is exactly the same as before.
> 
> 
> So now you're proposing that this be a special case when a function is
> declared by that particular syntax, and it should be different to when
> a function is created outside the class definition and added as a
> method to the object at run-time.
> 
> Thus breaking not only "explicit is better than implicit",

This one can be subject to discussion. Actually, we must explicitely 
declare the instance in the params list, but it's implicitely passed at 
calltime by the method descriptor.

> but also
> "special cases aren't special enough to break the rules".

Yeps, I think this is what I don't like here.

> Still -1.

I'm not yet ready to vote for Edward's proposition - as you say, it 
makes 'def statements into a class statement' a special case, and I 
don't like special cases too much (OTOH, there actually *are* special 
cases - __new__() being an example) - *but* it's not that silly either 
IMHO, and I think this should not be dismissed on a purely reactional basis.

IOW, let's give Edward some time to come up with enough rope so we can 
hang him to the nearest (AS) Tree !-)




More information about the Python-list mailing list