[Python-ideas] Enums

Michael Foord fuzzyman at gmail.com
Fri Jul 29 02:15:46 CEST 2011


On 29 July 2011 01:03, Michael Foord <fuzzyman at gmail.com> wrote:

>
>
> On 29 July 2011 00:58, Raymond Hettinger <raymond.hettinger at 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.
>
>
>
>
> --
>
> 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
>
>
>


-- 

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110729/9db4599b/attachment.html>


More information about the Python-ideas mailing list