[Python-Dev] bool conversion wart? (original) (raw)
Stephen J. Turnbull turnbull at sk.tsukuba.ac.jp
Fri Feb 23 03:31:15 CET 2007
- Previous message: [Python-Dev] bool conversion wart?
- Next message: [Python-Dev] bool conversion wart?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Neal Becker writes:
Well consider this:
str (4) '4' int(str (4)) 4 str (False) 'False'
bool(str(False)) True
Doesn't this seem a bit inconsisent?
The former case is a conversion from an expression that does not have an interpretation in a numerical context to an integer.
The latter case is a canonicalization from an expression that does have an interpretation in a boolean context to the equivalent boolean constant.
I don't have a problem with that. YMMV.
- Previous message: [Python-Dev] bool conversion wart?
- Next message: [Python-Dev] bool conversion wart?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]