test for isInRange?

Janko Hauser jhauser at ifm.uni-kiel.de
Wed Mar 1 06:29:35 EST 2000


Oh, that simple :-)!

This is the way I would have done it. But this is not optimal if it needs
to be done over and over again, for thousands of data points, possibly
with more than one range (in more than one dimension), but than
probably I haven't formulated my question right. 

I think in the end it would be something like this, but with a better,
in some way sorted data representation.

Thanks, nevertheless

__Janko


Gerrit Holl <gerrit at nl.linux.org> writes the right answer:

> >>> x=5
> >>> 1<x<6
> 1
> >>> 1<x<4
> 0
> 
> >>> if x_low < x < x_high and y_low < y < y_high:
> ...     print "Huray!"
> 

-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany



More information about the Python-list mailing list