noob question: "TypeError" wrong number of args

Edward Elliott nobody at 127.0.0.1
Tue May 2 19:10:43 EDT 2006


Bruno Desthuilliers wrote:
> Edward, I know I told you so at least three times, but really,
> seriously, do *yourself* a favor : take time to read about descriptors
> and metaclasses - and if possible to experiment a bit - so you can get a
> better understanding of Python's object model. Then I'll be happy to
> continue this discussion (.

Will do, if nothing else it will eliminate language barriers, which we may
be running into at this point (though you've indicated otherwise).  It
probably won't happen for another week or two at though.  I appreciate your
patience and willingness to engage in this discussion.

As a last ditch effort to get my point across:

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.

I can prove that assertion too: make a simple text processor that reads
Python source code and outputs the same source code with only one change:
insert the string 'self" as the first parameter of every "def somemethod". 
Next run the output source code with the normal Python interpreter. 
Everything functions *exactly* as before because the code is *exactly* the
same as what you would have written if you'd put the 'self's in there
manually.  Now make the Python interpreter invoke this text processor as
the first step in processing source code.  Voila, python + implicit self.  

No changes to the object model.
No changes to dynamic binding.
Same "runnable" code as before.
Where is the problem in this scheme?
Or (since I haven't read up on the object model yet) simply: Is there a
problem?




More information about the Python-list mailing list