Why self?
Delaney, Timothy
tdelaney at avaya.com
Tue Jul 9 20:27:37 EDT 2002
> Louis> This one is lost on me. Sorry, I'm not operating at your
> Louis> level. What is the point? I advocated initializing object
> Louis> variables in a mandatory __init__ statment. So you should have
> Louis> added
>
> Louis> def __init__(self):
> Louis> name=None
Why are you assigning None to the local variable "name", and then not using
it?
That's the basic problem here - there is no way of knowing if "name" is
supposed to be a local variable which will be used only in __init__, or
whether you want to create an instance name.
Also, how would you then create proxy objects? If you *must* know the name
of all attributes, you can't delegate "everything except what I want to
intercept".
Tim Delaney
More information about the Python-list
mailing list