
On 29 July 2011 01:03, Michael Foord <fuzzyman@gmail.com> wrote:
On 29 July 2011 00:58, Raymond Hettinger <raymond.hettinger@gmail.com>wrote:
On Jul 28, 2011, at 4:42 PM, Michael Foord wrote:
Why not Colors.inject(__name__)?
Because enums aren't import enough to warrant introducing little atrocities into the language.
Uh ?? It's the same code just taking a module name instead of requiring you to pull the module out of sys.modules yourself. It's not an atrocity at all.
To make it clear, the one-line-works-everywhere alternative people will use is: Colors.inject(sys.modules[__name__]) Which is clearly worse. Michael
Michael
Raymond
P.S. I used the term "language" instead of stdlib because I expect enums to be like decorators and context managers in that they will be used almost everywhere -- you won't be able to ignore them. Effectively, they will become a core language feature.
--
May you do good and not evil
May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html