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