Python misconceptions in IBM Ruby article...
mwh21 at cam.ac.uk
Fri Feb 18 11:42:06 EST 2000
Robin Becker <robin at jessikat.demon.co.uk> writes:
> I guess the objection is to not having a standard name for the instance
> in class functions. If we had the standard set at self you could
> presumably write
> class dingo:
> def normal_func(a1,a2,....):
> classdef instance_func(a1,a2,...):
> ie you could distinguish in the class definition between the kinds of
> functions. Presumably normal_func cannot refer to self and instance_func
> can. Also I assume that normal_func would live while the class does
> which is more difficult in python.
One wonders in this case you (not you Robin, the general "you" -
probably should be "one", but that sounds odd in English...) intend to
create instance variables, or alternatively have locals that are not
instance variables. I don't really see that there is any viable
alternative to the `self' approach in Python, for a variety of
reasons. The status quo is simple, explicit, consistent and has as
about as much chance of changing as the whitespace issue so there
isn't a lot of point debating it, I'd have thought.
More information about the Python-list