Hey thanks for that link Marius :) For anyone who's interested, here's the suggestion he was referencing:
"- Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators." On Wed, Jan 28, 2009 at 6:15 AM, Marius Gedminas <[email protected]> wrote: > On Tue, Jan 27, 2009 at 07:24:13PM -0800, James Paige wrote: > > You can't use "self" in the "def" line. Here is how I usually accomplish > > what you are trying to do: > > > > class Car(Basicsprite): #car class > > def __init__(self, speedarg=(0,0)): > > self.speed = speedarg > > Basicsprite.__init__(self) > > def move(self, speedv=None): > > if speedv==None: speedv = self.speedv > > self.rect = self.rect.move(speedv) > > > > > > But maybe somebody else can suggest a nicer way to do that. > > The idiomatic way to express that is 'if speedv is None:'. > See http://www.python.org/dev/peps/pep-0008/ > > Marius Gedminas > -- > lg_PC.gigacharset (lg = little green men language, PC = proxima centauri) > -- Markus Kuhn provides an example of a locale > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iD8DBQFJgGidkVdEXeem148RAkO0AJ9HCXWcvCbJeJxctMEoqVlTLXNRvQCgk1Oo > vW/kT4jEnhftgSWgEDPo5o0= > =Ijvy > -----END PGP SIGNATURE----- > >
