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/071329.html below:

[Python-Dev] bool conversion wart?

[Python-Dev] bool conversion wart? [Python-Dev] bool conversion wart?Mike Klaas mike.klaas at gmail.com
Fri Feb 23 02:39:48 CET 2007
On 2/22/07, Neal Becker <ndbecker2 at gmail.com> wrote:

> Well consider this:
> >>>str (4)
> '4'
> >>>int(str (4))
> 4
> >>>str (False)
> 'False'
>
> >>>bool(str(False))
> True
>
> Doesn't this seem a bit inconsisent?

Virtually no python objects accept a stringified version of themselves
in their constructor:

>>> str({})
'{}'
>>> dict('{}')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: dictionary update sequence element #0 has length 1; 2 is required
>>> str([])
'[]'
>>> list('[]')
['[', ']']

Python is not Perl.

-Mike
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