Selecting elements from a list

Mike C. Fletcher mcfletch at rogers.com
Thu Sep 4 20:22:09 EDT 2003


Martin Christensen wrote:

>B = []
>for i in A:
>    if A.property():
>       B.append(i)
>  
>
B = [ i for i in A if i.property() ]

Seems elegant, but then I'd like dictionary-comps if they came along,
Mike

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list