Arrays/List, filters, Pytho, Ruby

Arnaud Delobelle arnodel at gmail.com
Sat Feb 12 18:00:25 EST 2011


"LL.Snark" <ll.snark at gmail.com> writes:

> Hi,
>
> I'm looking for a pythonic way to translate this short Ruby code :
> t=[6,7,8,6,7,9,8,4,3,6,7]
> i=t.index {|x| x<t.first}
>

In Python3:

>>> t = [6,7,8,6,7,9,8,4,3,6,7]
>>> next(filter(t[0].__gt__, t))
4

-- 
Arnaud



More information about the Python-list mailing list