Why self?
Mark McEahern
marklists at mceahern.com
Fri Jul 5 12:21:16 EDT 2002
> Roy Smith <roy at panix.com> wrote:
>
> > Other than in an obfuscated python contest, I can't think of any reason
> > why anybody would *ever* use any variable name other than "self" as the
> > first formal parameter of a method.
> >
> > Have you ever seen an example that does?
[Christian Tanzer]
> Here's an example that should use another name than `self`:
[snip example of __new__ and discussion of metaclasses]
staticmethod is another example of a type of method whose first parameter
should not be self.
Of course, I don't doubt Roy implicitly meant first formal parameter of
normal instance methods. That was the context of the original message,
anyway.
// mark
-
More information about the Python-list
mailing list