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

2013年4月25日 12:09:25 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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).
> This is how classes work.
Not really. Normal classes, when called, give you a new instance: they
don't look up existing instances.
Tres.
- -- 
===================================================================
Tres Seaver +1 540-429-0999 [email protected]
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iEYEARECAAYFAlF5fa4ACgkQ+gerLs4ltQ7FSwCgzhcoXonMO/7W+xYMpM4EvtTj
nPIAnAkHtWxFMaU3dqfFUclNQkUcJ2FZ
=C0/7
-----END PGP SIGNATURE-----
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to