[Tutor] Re: [Edu-sig] style question

Remco Gerlich scarblac@pino.selwerd.nl
Thu, 21 Feb 2002 00:10:50 +0100


On  0, "Michael P. Reilly" <arcege@speakeasy.net> wrote:
> However, it is still a "bad idea" to add boolean values.

However, a%2 isn't a boolean just because it's either 0 or 1. It's the
remainder if a is divided by 2. And the sum of those remainders is
obviously the number of nubmers that were odd.

> A true integer
> is anything that is not zero.  Conceivably, this could be -1;  I could
> easily create a __eq__ method (in Py2.1 and later) that returns -1 or
> 1e10 or even "true".

Yes. But the truth value was never tested, and isn't relevant. This is a
good kneejerk reaction in many cases, but not here :-)

-- 
Remco Gerlich