pythonic way

Ian Kelly ian.g.kelly at gmail.com
Thu Nov 1 12:40:38 EDT 2012


On Thu, Nov 1, 2012 at 9:32 AM, inshu chauhan <insideshoes at gmail.com> wrote:

>  what is the most pythonic way to do this :
>
>                    if 0 < ix < 10 and 0 < iy < 10 ???
>

I suppose you could do

    if all(0 < i < 10 for i in (ix, iy)):

but I think that the original is more readable unless you have several
variables to test.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121101/b34f8cb9/attachment.html>


More information about the Python-list mailing list