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/2013-April/125694.html below:

[Python-Dev] enum discussion: can someone please summarize open issues?

[Python-Dev] enum discussion: can someone please summarize open issues? [Python-Dev] enum discussion: can someone please summarize open issues?Greg Ewing greg.ewing at canterbury.ac.nz
Mon Apr 29 08:40:16 CEST 2013
Steven D'Aprano wrote:
> On 29/04/13 10:29, Ethan Furman wrote:
> 
>>    - bool(1)    # True
>>    - int('11')  # 11
>>    - str(var)   # whatever var had in it, now as a str
> 
> I think that's a red herring, because you're comparing the use of the 
> object constructor with look-up by name.

How does what bool() is doing differ from a lookup?
It's not constructing a new instance. Neither is
int() in the cases where the argument is in the
range of values that it caches.

More generally, the built-in types can be thought
of as coercion functions -- they take an argument
and return some related value from the type's
repertoire. Whether they do that by constructing
a new object or not is an implementation detail.

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