Arrays/List, filters, Pytho, Ruby

Arnaud Delobelle arnodel at gmail.com
Sun Feb 13 00:00:25 CET 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