Hmm... An idea: if a,b==c,d:

Alex Martelli aleax at aleax.it
Mon Nov 18 18:21:46 EST 2002


Richard Dillingham wrote:

 
> This would mean that lines like the following:
> if posx>=coords[0] and posy>=coords[1] and posx<=coords[2] and
> posy<=coords[3]:
> 
> Could be rewritten like so:
> if posx,posy>=coords[0],coords[1] and posx,posy<=coords[2],coords[3]

It's better written as:

if coords[0]<=posx<=coords[2] and coords[1]<=posy<=coords[3]:

anyway (besides the many other correct things that have already been pointed 
out on this thread -- hadn't seen this one though [having admittedly just 
skimmed the thread...]).


Alex




More information about the Python-list mailing list