I think, in that particular example, that is an ok solution, however if you
are combining multiple booleans to create a lambda or separate function
that is quite a bit of syntactical sugar to add (unless it is re-used).

H-J

On 23 February 2017 at 18:11, Régis Martin <rmar...@astek.fr> wrote:

> Hello,
> why not using the filter function?
>
> for x in filter(is_prime, range(100)):
>     # do something with x
>
> This is equivalent as was mentionned at first:
>
>     for x in range(100) if is_prime(x):
>         # do things with x
>
> Régis
>
> --
> Régis  Martin
> Directeur de Projets Astek Industrie
> Tel: 06-83-53-15-05
> http://www.groupeastek.com/
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to