"self" - a python wart or "feature"
maxm at mxm.dk
Mon Feb 17 11:12:29 CET 2003
Bengt Richter wrote:
> In your example, you don't explicitly use self, so it seems useless.
> Try writing an example that sets instance attributes and uses class
> variables and also makes use of temporary local variables in a method.
could be implicit in any function.
self.x = self.x + x
return self.x * y
The real problem is because Python can have unbound methods. Which is
like class members, only outside a class. Then you would need a self
parameter, and it would get messy.
hilsen/regards Max M Rasmussen, Denmark
Fremtiden, videnskab, skeptiscisme og transhumanisme
More information about the Python-list