[Python-Dev] enum discussion: can someone please summarize open issues?

Nick Coghlan ncoghlan at gmail.com
Mon Apr 29 00:28:34 CEST 2013


On 29 Apr 2013 07:32, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
>
> On Sun, 28 Apr 2013 13:02:11 -0700
> Guido van Rossum <guido at python.org> wrote:
> >
> > >   - for the above two, how should they be included/excluded?
> >
> > IMO Everything should be enumerated except
> > (a) things with a __get__() method (i.e. descriptors)
> > (b) __dunder__ names
>
> I think it would be nice to define regular methods on enums.

Functions are descriptors, so this rule already covers ordinary methods.
The slight concern I have with making the duck typed exclusion only
descriptors (rather than descriptors and callables) is that it means things
like functools.partial objects will be treated as enum values rather than
as static methods. OTOH, explicitly wrapping such callables in staticmethod
should still work, so the simpler rule is probably better.

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130429/4be7292d/attachment.html>


More information about the Python-Dev mailing list