Popular style document?

Björn Lindberg d95-bli.no at spam.nada.kth.se
Fri Mar 22 13:02:18 EST 2002


Terry Reedy wrote:

> "Björn Lindberg" <d95-bli.no at spam.nada.kth.se> wrote in message

> > How come Python doesn't have an "automatic" this-variable, like C++
> or
> > Java?

<snip>
 
> If you mean requirement to say def meth(something, arg) instead of def
> meth(arg), compiler does not necesarily know when compiling whether
> function will be used as method or not.  (Methods can be defined
> outside of class statement and assigned as method later.)

Yes, this is what I meant. How does this work though, when assigning a
method to a class? I mean, let's say that you have a method taking two
arguments, concatenate (x, y). When assigning this method to a class,
will that mean that the first argument is always replaced by the class
instance, so I'd have to call it like this: aclass.concatenate (y), and
the first argument, x, will always correspond to aclass?


Björn



More information about the Python-list mailing list