Popular style document?

Terry Reedy tejarex at yahoo.com
Thu Mar 21 21:51:15 EST 2002


"Björn Lindberg" <d95-bli.no at spam.nada.kth.se> wrote in message
news:3C9A797E.E6476BEE at spam.nada.kth.se...
> phil hunt wrote:
>
> > IMO the requirement to say self everywhere in methods is the worst
> > feature of python.
>
> How come Python doesn't have an "automatic" this-variable, like C++
or
> Java?

Short answer: the language has to work together as a whole.

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.)

If you mean requirement to say something.var instead of var, how else
would you write equivalent of self.arg = arg within method?

Terry J. Reedy






More information about the Python-list mailing list