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

[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard libraryEthan Furman ethan at stoneleaf.us
Thu Apr 25 22:14:19 CEST 2013
On 04/25/2013 12:02 PM, Tres Seaver wrote:
> On 04/25/2013 12:39 PM, Ethan Furman wrote:
>> Animals is a class. Giving Animals a parameter (such as 1 or 'ant')
>> should return the instance that matches.
>
> Animals is *not* a class -- it just uses the class syntax as a convenient
> way to set up the names used to construct the new type.  (This subtlety
> is why the metaclass hook is reputed to make peoples' brains explode).

So Animals is a type?  Like int?

--> int('5')  # 5

--> Animal(1)  # I think it should be Animal.ant  ;)


>> This is how classes work.
>
> Not really.  Normal classes, when called, give you a new instance:  they
> don't look up existing instances.

You mean like bool?

--
~Ethan~
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