integer >= 1 == True and integer.0 == False is bad, bad, bad!!!
Steven D'Aprano
steve-REMOVE-THIS at cybersource.com.au
Tue Jul 13 00:52:58 EDT 2010
On Mon, 12 Jul 2010 20:58:39 -0700, Paul Rubin wrote:
> Steven D'Aprano <steve-REMOVE-THIS at cybersource.com.au> writes:
>> What Python does instead is to accept *any* object in a context where
>> other languages (such as Pascal) would insist on a boolean.
>
> I'm aware of what Python does, just saying I can sympathize with the
> sentiment that explicit conversions would make more sense. I wouldn't
> change it in Python since it's what we're all used to, but if I were
> designing a language from scratch I'd probably make it explicit.
Fair enough, and that's a reasonable design choice too. Ruby, for
example, only has two false values: False and Null.
--
Steven
More information about the Python-list
mailing list