D
Daniel Nogradi
Is looping over a list of objects and modifying (adding an attribute
to) each item only possible like this?
mylist = [ obj1, obj2, obj3 ]
for i in xrange( len( mylist ) ):
mylist.newattribute = 'new value'
I'm guessing there is a way to do this without introducing the (in
principle unnecessary) index i, so what I'm really looking for is a
looping method which doesn't pass references to the values of the
items but to the items themselves.
to) each item only possible like this?
mylist = [ obj1, obj2, obj3 ]
for i in xrange( len( mylist ) ):
mylist.newattribute = 'new value'
I'm guessing there is a way to do this without introducing the (in
principle unnecessary) index i, so what I'm really looking for is a
looping method which doesn't pass references to the values of the
items but to the items themselves.