"Daniel Nogradi" <[EMAIL PROTECTED]> writes:
> 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[i].newattribute = 'new value'
for m in mylist:
m.ne
> Call me crazy, but isn't the simple construct
> for obj in mylist:
> obj.newattribute = 'new value'
> what the OP was looking for?
Yes, of course. That's why my follow-up post was this:
> Please consider the previous question as an arbitrary random brain
> cell fluctuation whose pro
John Machin wrote:
> James Stroud wrote:
>
>>Daniel Nogradi wrote:
>>
>>>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[i].newattribute = 'new
James Stroud wrote:
> Daniel Nogradi wrote:
> > 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[i].newattribute = 'new value'
> >
> >
> > I'
Daniel Nogradi wrote:
> 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[i].newattribute = 'new value'
>
>
> I'm guessing there is a way to do this wi
> 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[i].newattribute = 'new value'
>
>
> I'm guessing there is a way to do this without introducing the (in
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[i].newattribute = 'new value'
I'm guessing there is a way to do this without introducing the (in
principle unnec