[Python-Dev] PEP 435 - requesting pronouncement

Eli Bendersky eliben at gmail.com
Mon May 6 00:27:36 CEST 2013


On Sun, May 5, 2013 at 10:46 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Sun, 5 May 2013 07:09:14 -0700
> Eli Bendersky <eliben at gmail.com> wrote:
> > On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou <solipsis at pitrou.net>
> wrote:
> >
> > > On Sat, 4 May 2013 15:04:49 -0700
> > > Eli Bendersky <eliben at gmail.com> wrote:
> > > > Hello pydev,
> > > >
> > > > PEP 435 is ready for final review. A lot of the feedback from the
> last
> > > few
> > > > weeks of discussions has been incorporated.
> > >
> > > 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),
> >
> > Plenty of points were raised against having this members= API.
>
> The main point seems to be "I don't like it". If you consider this a
> strong argument against the concrete issues with the functional API,
> then good for you.
>
> > Guido publicly asked to decide in favor of the
> > functional API, and we added an explicit warning about pickling (which
> was
> > lifted from the docs of pickle itself).
>
> This is not true. The pickling restrictions which have been raised are
> specifically caused by the functional syntax, something which your
> warning omits.
>
> > If you feel this has to be
> > discussed further, please open a new thread. I don't want another 100
> > bikeshedding emails to go into this one.
>
> This is not bikeshedding since it addresses concrete functional issues.
> (but apparently you would very much like to sweep those issues under
> the carpet in the name of "bikeshedding")
>

I'm sorry that you're taking this issue so personally, Antoine.

As for pickling enums created with the functional API, I don't think we now
provide less than the pickle module dictates in the general sense. The
pickle docs say:

The following types can be pickled:
  [...]

   - classes that are defined at the top level of a module
   - instances of such classes whose __dict__ or the result of calling
   __getstate__() is picklable (see section *Pickling Class
Instances*<http://docs.python.org/dev/library/pickle.html?highlight=pickle#pickle-inst>for
details).

I'll open a separate thread about how this can be implemented and
documented in the best way possible, but I really don't see it as an
unsolvable issue.

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130505/a8c0bca9/attachment.html>


More information about the Python-Dev mailing list