Re: Is this an ok thing to do in a class

2010-05-18 Thread Vincent Davis
On Tue, May 18, 2010 at 3:15 PM, Ethan Furman wrote: > Vincent Davis wrote: > >> >> What you are pointing out is that the assignment is not reversed . But >> that does make me thing of something I had not. >> >> >>> afoo.letter['a'] = 345 >> >>> afoo.A >> 1 >> >> Thats kinda a bummer, whats a g

Re: Is this an ok thing to do in a class

2010-05-18 Thread Ethan Furman
Vincent Davis wrote: On Tue, May 18, 2010 at 2:41 PM, Ethan Furman > wrote: Do you expect afoo.letter[x] to always be afoo.x? Because they aren't: >>> afoo.A = 9 >>> afoo.letter['a'] 1 What you are pointing out is that the assignment is not revers

Re: Is this an ok thing to do in a class

2010-05-18 Thread Vincent Davis
On Tue, May 18, 2010 at 2:41 PM, Ethan Furman wrote: > > Do you expect afoo.letter[x] to always be afoo.x? Because they aren't: > > >>> afoo.A = 9 > >>> afoo.letter['a'] > 1 > What you are pointing out is that the assignment is not reversed . But that does make me thing of something I had not.

Re: Is this an ok thing to do in a class

2010-05-18 Thread Ethan Furman
Vincent Davis wrote: Just wondering if there is a problem with mixing a dictionary into a class like this. Everything seems to work as I would expect. class foo(object): def __init__(self, x): self.letter = dict(a=1,b=2,c=3) self.A=self.letter['a'] self.x=self.letter

Re: Is this an ok thing to do in a class

2010-05-18 Thread Vincent Davis
Thanks for the feed back Vincent On Tue, May 18, 2010 at 8:50 AM, Bruno Desthuilliers wrote: > Simon Brunning a écrit : > >> On 18 May 2010 06:21:32 UTC+1, Vincent Davis >> wrote: >> >>> Just wondering if there is a problem with mixing a dictionary into a >>> class like this. Everything seems

Re: Is this an ok thing to do in a class

2010-05-18 Thread Bruno Desthuilliers
Simon Brunning a écrit : On 18 May 2010 06:21:32 UTC+1, Vincent Davis wrote: Just wondering if there is a problem with mixing a dictionary into a class like this. Everything seems to work as I would expect. No problem at all AFAIC. OP didn't show up on c.l.py, so too bad you snipped the re

Re: Is this an ok thing to do in a class

2010-05-18 Thread Simon Brunning
On 18 May 2010 06:21:32 UTC+1, Vincent Davis wrote: > > Just wondering if there is a problem with mixing a dictionary into a class > like this. Everything seems to work as I would expect. No problem at all AFAIC. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list