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 vinc...@vincentdavis.net 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. --

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 vinc...@vincentdavis.net 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

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 bruno.42.desthuilli...@websiteburo.invalid wrote: Simon Brunning a écrit : On 18 May 2010 06:21:32 UTC+1, Vincent Davis vinc...@vincentdavis.net wrote: Just wondering if there is a problem with mixing a

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']

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 et...@stoneleaf.us 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

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 et...@stoneleaf.us mailto:et...@stoneleaf.us 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

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 et...@stoneleaf.us 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 good way

Is this an ok thing to do in a class

2010-05-17 Thread Vincent Davis
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[x] afoo = foo('b')