[pypy-dev] __builtin__ module

Christian Tismer tismer at tismer.com
Sat Jan 25 04:21:22 CET 2003


Nathan Heagy wrote:
>     BTW the syntax "i not in range(256)" is more conceptual than "i<0 or
>     i>=256"
>     and expresses better what we are testing for (as the error message
>     suggests
>     too).
> 
> 
> Why not "if 0 < i < 256:" ?

Well, the generated code should finally be the same.
But "i not in range(256)" expresses that i should
not be in the set of those 256 values.
That's more expressive, since it does not imply that
i needs to be an integer at all. It does not impose that
i has a data type that is ordered, and it does not require
that i has to know how to compare itself to be less
or greater than anything else.
It just says "do not be any of these".

ciao - chris



More information about the Pypy-dev mailing list