[Python-ideas] Enums
Michael Foord
fuzzyman at gmail.com
Fri Jul 29 02:46:39 CEST 2011
On 29 July 2011 01:27, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Jul 29, 2011 at 9:58 AM, Raymond Hettinger
> <raymond.hettinger at gmail.com> wrote:
> > 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.
>
> I agree with this - and I think it's the named value aspect that will
> make them so pervasive. It's why I keep hitting on
> collections.namedtuple as a source of inspiration - it adds as little
> as possible to ordinary tuples to provide the additional benefits.
> Enums, on the other hand, come with a lot of excess baggage that many
> potential use cases simply don't need.
>
>
I agree "named values" would get us *most* of the value, and would both be
less contentious and provide a common building block for third party
libraries to build interesting and perhaps esoteric uses on.
I *like* grouped named values (I think they make nice apis to read and use
when used appropriately), but hey-ho.
Michael
> Cheers,
> Nick.
>
> --
> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
>
--
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/ae50f531/attachment.html>
More information about the Python-ideas
mailing list