can a method access/set another's variables?
wswilson
wswilson at gmail.com
Mon Apr 2 12:50:46 EDT 2007
On Apr 2, 1:04 am, a... at mac.com (Alex Martelli) wrote:
> asdf1234234 <wswil... at gmail.com> wrote:
> > My code is:
> > -a.py-
> > import b
>
> > class A:
> > def __init__(self):
> > pass
>
> Incidentally, these last two lines are totally, utterly useless. Do NOT
> define special methods like this -- just omit the whole def statement
> and you'll have identical semantics, no wasted boilerplate, even better
> performance.
>
> Alex
I know they're useless. I was using the init method before and just
replaced what I had with pass instead of deleting it because I
expected to use it again later. Thanks for the tip, though.
More information about the Python-list
mailing list