pythonic way

Tim Chase python.list at tim.thechases.com
Thu Nov 1 11:57:12 EDT 2012


On 11/01/12 10:32, inshu chauhan wrote:
>  what is the most pythonic way to do this :
> 
>                    if 0 < ix < 10 and 0 < iy < 10 ???

What's wrong with the syntax you provide?  It's perfectly pythonic:

  ix = 42
  yx = 3.14159
  if 0 < ix < 10 and 0 < iy < 10:
    do_stuff(ix, iy)
  else:
    do_other_stuff(ix, iy)

-tkc






More information about the Python-list mailing list