Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32562

Re: pythonic way

Date 2012-11-01 10:57 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: pythonic way
References <CAFqGZREfq7fO4Okf1Oj9HBeUkWLYK_9=ho8N47_kyTKudGZSFA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3154.1351785382.27098.python-list@python.org> (permalink)

Show all headers | View raw


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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: pythonic way Tim Chase <python.list@tim.thechases.com> - 2012-11-01 10:57 -0500

csiph-web