Op 2017-08-11, Paul Rubin schreef <no.email@nospam.invalid>:
> I don't think we need this since we have itertools.takewhile:
>
>   from operator import gt
>   from functools import partial
>   from itertools import takewhile
>
>   [x + 1 for x in takewhile(partial(gt,5), (0,1,2,999,3,4))]
>

No need for partial and gt.

  [x + 1 for x in takewhile((5).__gt__, (0,1,2,999,3,4))]

Basically, Haskell's infix opererator sections can often be
translated into Python by attribute access to the bound method.

Stephan
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to