Kreso a écrit :
I would like to create a list-like container class so that, additionally
to usual list methods, I could attach attributes to the container instances.
However, I would like it so that the items contained in the particular
instance of container somehow 'inherit' those attributes i.e.

cont = Container()
cont.color = 'blue'
cont.append(item)
print item.color
'blue'


This is named "environmental aquisition" (or simply "aquisition") and is one of the base mechanisms in Zope 2. While an interesting idea, from experience, it can rapidly turn into a total maintainance nightmare if not used with care :-/

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to