Python - modifying items in a list -


i have list of instances of class a

class a: def __init__(self,ox,oy): self.x=ox self.y=oy  list1=[a(3,0),a(5,0),a(7,3),......] 

now need find out instance in list has y' non-zero - , apply value other members in list.
given 1 unique member have y non-zero.
usual for-loop need iterate list twice - or without comprehension.
there way achieve better.
have not used filter , map feel there may better option.
appreciated.

no, there isn't. @ least 2 loops required no matter how implemented.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -