Using function parameters to determine method kind

Humpty Dumpty oliver.schoenborn at utoronto.ca
Sun Jun 6 08:56:55 EDT 2004


From: "Michele Simionato" <michele.simionato at poste.it>
> No, I had in mind this (contrived) example:
>
> class Outer(object):
>       def outermeth(self1):
>           class Inner(object):
>                 def innermeth(self2):
>                     <do-something-with-self1-and-self2>
>           ...
>
> It is nice to have the ability to give any name to "self".
> like that).

Strange, I would have thought that self1 would not be in scope (it's not in
the local scope and it's not in the global scope AFAICT). If true, you'd
have to have a parameter to your innermeth, which you can call whatever you
want so call it self1. Have scoping rules changed in Python?

Oliver





More information about the Python-list mailing list