New submission from Heather:

I have tried both Python 2.4.4 and 2.5.1 and for both, I get the
following results when running the following code:
IDLE 1.2.1      
>>> class Style:
       stylename=''
       value=''

>>> class Widget:
       styles = {}
       def setStyle(self, stylename, value):
               style = Style()
               style.stylename = stylename
               style.value = value
               self.styles[stylename]=style

>>> class Container:
       widgets = []
       def addWidget(self, stylename, value):
               widget = Widget()
               widget.setStyle(stylename,value)
               self.widgets.append(widget)

>>> container = Container()
>>> container.addWidget('backgroundColor','red')
>>> container.widgets[0].styles['backgroundColor'].value
'red'
>>> container.addWidget('backgroundColor','blue')
>>> container.widgets[0].styles['backgroundColor'].value
'blue'
>>> container.widgets[1].styles['backgroundColor'].value
'blue'
>>> 
If I am doing something wrong here, please let me know. But it seems to
me to be an error that List.append() will overwrite existing entries
when using the code above - - 
Thank you,

-Heather

----------
components: None
messages: 62275
nosy: sunaluak
severity: major
status: open
title: List of Dicts problem
type: behavior
versions: Python 2.4, Python 2.5

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2064>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to