<p dir="ltr"><br>
On 3 May 2013 08:00, "Eli Bendersky" <<a href="mailto:eliben@gmail.com">eliben@gmail.com</a>> wrote:<br>
><br>
> > Eli, it would be nice if you stopped with this claim.<br>
>><br>
>><br>
>> I'm not advocating "not having a convenience syntax", I'm advocating<br>
>> having a convenience syntax which is *class-based* rather than<br>
>> function-based.<br>
>><br>
>> Debuggers are beside the point: there are two kinds of "convenience<br>
>> syntax" on the table; one allows pickling by construction, one<br>
>> requires an ugly hack which may not solve all cases (and which may<br>
>> apparently make Jython / IronPython mildly unhappy). Why you insist<br>
>> on ignoring the former and imposing the latter is beyond me.<br>
><br>
><br>
> I'm not trying to belittle our class-based suggestion. I just think there are two separate issues here, and I was focusing on just one of them for now. The one I've been focusing on is how to make the function-based convenience syntax work with pickling in the vast majority of interesting cases. This appears to be possible by using the same pattern used by namedtuple, and even better by encapsulating this pattern formally in stdlib so it stops being a hack (and may actually be useful for other code too).<br>

><br>
> The other issue is your proposal to have a class-based convenience syntax akin to (correct me if I got this wrong):<br>
><br>
> class Animal(Enum):<br>
>   __values__ = 'cat dog'</p>
<p dir="ltr">I would suggest moving the field names into the class header for a class based convenience API:</p>
<p dir="ltr">class Animal(Enum, members='cat dog'): pass</p>
<p dir="ltr">Cheers,<br>
Nick.<br></p>
<p dir="ltr">><br>
> This is obviously a matter of preference (and hence bikeshedding), but this still looks better to me:<br>
><br>
> Animal = Enum('Animal', 'cat dog')<br>
><br>
> It has two advantages:<br>
><br>
> 1. Shorter<br>
> 2. Parallels namedtuple, which is by now a well known and widely used construct<br>
><br>
> On the other hand, your proposal has the advantage that it allows pickles without hacks in the implementation.<br>
><br>
> Did I sum up the issues fairly?<br>
><br>
> I don't know what to decide here. There's no clear technical merit to decide on one against the other (IMHO!), it's a matter of preference. Hopefully Guido will step in and save us from our misery ;-)<br>

><br>
> Eli<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a><br>
> Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com">http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com</a><br>
><br>
</p>