On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou <solip...@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) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com