Is this an ok thing to do in a class

Ethan Furman ethan at stoneleaf.us
Tue May 18 17:15:04 EDT 2010


Vincent Davis wrote:
> On Tue, May 18, 2010 at 2:41 PM, Ethan Furman <ethan at stoneleaf.us 
> <mailto:ethan at 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 not.
> 
>  >>> afoo.letter['a'] = 345
>  >>> afoo.A
> 1
> 
> Thats kinda a bummer, whats a good way to make sure affo.A gets updated?

It's possible, and not too tough, but... why do you need it done that 
way?  Keeping redundant information seems like extra work with no advantage.

~Ethan~



More information about the Python-list mailing list