modify element of a list.

Pierre Quentel quentel.pierre at wanadoo.fr
Thu Aug 17 12:09:23 EDT 2006


Hi,

The most simple is to use the index of the element in the list :

def setAttribute(self, desc, value):
   n = anObject(desc, value)
   for i,o in enumerate(self.Objects):
      if o.getDescription() == desc:
         self.Objects[i] = n
         return 
   self.Objects.append(n)

Pierre




More information about the Python-list mailing list