Hello everyone,What is the pythonic was of selecting the first element of a list matching some condition?
I often end up using
[x for x in lst if cond(x)][0]
This looks bad and raises IndexError if nothing is found which
is ugly too.
Thanks. -- ~noufal http://nibrahim.net.in/ _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
