Why self?
Louis M. Pecora
pecora at anvil.nrl.navy.mil
Mon Jul 8 16:50:37 EDT 2002
In article <mailman.1026156912.29570.python-list at python.org>, Brian
Quinlan <brian at sweetapp.com> wrote:
> If the explicit self argument were removed, what would you add to the
> language to differentiate between local and instance variables?
>
Here's a stab.
(1) All self variables have to be initialized in __init__. That's just
good practice anyway. They are labeled with self in __init__ otherwise
they are local.
(2) There can be no name conflicts between local and self variables.
Also good practice within an object.
--
Lou Pecora
- My views are my own.
More information about the Python-list
mailing list