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 -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -