Re: Class attributes newbie question (before I join a cargocult)

2006-03-13 Thread Peter Otten
EP wrote: > This is likely a stupid question, There seems to be a cult believing that calling one's own question "stupid" magically diminishes its degree of stupidity. In reality, as a compiler would put it, "code has no effect". > but I am confused about what is going > on with class attribut

Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread Steven D'Aprano
On Sun, 12 Mar 2006 10:53:57 -0800, pclinch wrote: > See __slots__ and PyChecker for possible ways to avoid misspelled > instance variables. __slots__ are not meant as a way to implement variable declarations. __slots__ are meant as a memory optimization for cases where you have large numbers (te

Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread EP
Thanks. Argh. I've failed to find the behavoir I need to understand. More coffee and re-reading my code. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread [EMAIL PROTECTED]
Should't the changeSex method be: def changeSex(self, newsex=""): self.sex = newsex return self.sex You're creating a new instance variable at the moment i.e 'self.mysex' doesn't exist until you call changeSex. -- http://mail.python.org/mailman/listinfo/python-list

Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread pclinch
EP wrote: > Hi, > > This is likely a stupid question, but I am confused about what is going > on with class attributes as far as whether they "stick". I ran across > this in a program I am writing, but have reproduced the behavoir below > - can someone point me in the right direction (thanks): >

Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread kalahari
def changeSex(self, newsex=""): self.mysex=newsex ---> self.mysex return self.mysex def whoAmI(self): return self.name, self. sex ->> self.sex -- http://mail.python.org/mailman/listinfo/python-list

Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread Christoph Haas
Am Sonntag, 12. März 2006 19:36 schrieb EP: > This is likely a stupid question, but I am confused about what is going > on with class attributes as far as whether they "stick". I ran across > this in a program I am writing, but have reproduced the behavoir below > - can someone point me in the rig