[Python-Dev] PEP 435 - requesting pronouncement

Guido van Rossum guido at python.org
Sun May 5 19:40:40 CEST 2013

On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> I still would like to see Nick's class-based API preferred over the
> functional API:
>    class Season(Enum, members='spring summer autumn'):
>       pass
> The PEP doesn't even mention it, even though you got significant
> pushback on the proposed _getframe() hack for pickling (including
> mentions that IronPython and Cython may not support it), and nobody
> seemed to be unhappy with the class-based proposal.

This particular bikeshed has sailed.

I heard all the feedback, took into account my own thoughts, and have
decided that we should go ahead with this syntax and the _getframe()
hack. If the _getframe() hack doesn't work on a given platform, the
__module__ attribute is not set correctly, so pickling will fail, but
everything else will work. We can work on a PEP to replace the
_getframe() hack separately; I think it's functionality that is useful
beyond Enum() and namedtuple(), and can be implemented on all
platforms with something a lot less general than _getframe().

Authors can also avoid the _getframe() hack in two ways: (a) use the
full class definition; (b) specify the full dotted class name in the
call. (We should modify namedtuple() to support this too BTW.)

--Guido van Rossum (python.org/~guido)

More information about the Python-Dev mailing list