SV: True/false integer values

Carsten Gehling carsten at gehling.dk
Fri May 2 23:10:18 EDT 2003


> Fra: python-list-admin at python.org
> [mailto:python-list-admin at python.org]Pa vegne af Erik Max Francis
> Sendt: 3. maj 2003 00:04

> The theory behind making the "true" value in a language -1 is usually
> because that's the integer all bits on (in 2's complement, anyway), and
> if your logical operators are really bitwise operators in disguise, then
> this makes sense (for instance, in some versions of BASIC).  If,
> however, you have separate logical operators that do short-circuiting,
> like Python and many other modern languages do, there's no need for the
> distinction.

Yes I know the theory, which actually was why I asked. As a matter of fact,
I like Pythons way of true = 1, since it means that the langauge isn't just
relying on the low-level bitwise operations - which again means that scripts
are more portable to other processors.

I'm just not used to it from other languages, that I use :-)

- Carsten






More information about the Python-list mailing list