Self Nanny

Fredrik Lundh effbot at telia.com
Tue Mar 7 14:16:33 EST 2000


Mark Hathaway <hathawa2 at marshall.edu> wrote:
> Was there a problem with doing it the other way around...

>     class aClass:
>         def __init__(self,number):
>             self.num = number
>             n = self.num
>
>     class aClass:
>         def __init__(number):
>             local.n = number

> where the roles are reversed. All object attributes are
> referred to by their names and any class (global) attributes
> are specified by "local.". This would decrease tremendously
> the need to write 'self.' and would still easily allow the
> differentiation of class-wide attributes from object attributes.

you sure lost me there.  do you want to make it
illegal to use local variables in methods?

what happened to num, btw?  and how come you don't
need to qualify the argument name?  and do you really
think it's a good idea to have different scoping rules for
methods and stand-alone functions?

> Which do you write more of? Object attribute names.

really?  I'm pretty sure I don't.

to prove that I'm a minority, why not analyze your
favourite Python application?

</F>





More information about the Python-list mailing list