A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-February/071334.html below:

[Python-Dev] bool conversion wart?

[Python-Dev] bool conversion wart? [Python-Dev] bool conversion wart?Stephen J. Turnbull turnbull at sk.tsukuba.ac.jp
Fri Feb 23 03:31:15 CET 2007
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.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4