On Sun, Apr 21, 2013 at 5:55 PM, Tim Delaney
wrote:
> On 22 April 2013 10:31, Barry Warsaw wrote:
>>
>> On Apr 22, 2013, at 09:31 AM, Tim Delaney wrote:
>>
>> >I'm fine with iteration order being by sorted name by default, so long as
>> >it's easily overrideable by enum subclasses or metaclasses
On Sun, 21 Apr 2013 20:28:16 -0400, Barry Warsaw wrote:
> On Apr 22, 2013, at 09:02 AM, Nick Coghlan wrote:
>
> >Iteration order matters a lot if you don't want people complaining about
> >enums being broken:
> >
> > class Days(enum.Enum):
> >Monday = 1
> >Tuesday = 2
> >Wednesday =
On 22 April 2013 10:31, Barry Warsaw wrote:
> On Apr 22, 2013, at 09:31 AM, Tim Delaney wrote:
>
> >I'm fine with iteration order being by sorted name by default, so long as
> >it's easily overrideable by enum subclasses or metaclasses e.g. an IntEnum
> >should probably iterate in value order.
>
On Mon, Apr 22, 2013 at 10:28 AM, Barry Warsaw wrote:
> On Apr 22, 2013, at 09:02 AM, Nick Coghlan wrote:
>
>>Iteration order matters a lot if you don't want people complaining about
>>enums being broken:
>>
>> class Days(enum.Enum):
>>Monday = 1
>>Tuesday = 2
>>Wednesday = 3
>>Th
On Apr 22, 2013, at 09:31 AM, Tim Delaney wrote:
>I'm fine with iteration order being by sorted name by default, so long as
>it's easily overrideable by enum subclasses or metaclasses e.g. an IntEnum
>should probably iterate in value order.
It does. :)
>For definition order, a 3.x-only metaclass
On Apr 22, 2013, at 09:02 AM, Nick Coghlan wrote:
>Iteration order matters a lot if you don't want people complaining about
>enums being broken:
>
> class Days(enum.Enum):
>Monday = 1
>Tuesday = 2
>Wednesday = 3
>Thursday = 4
>Friday = 5
>Saturday = 6
>Sunday = 7
Sorr
On 22 April 2013 09:02, Nick Coghlan wrote:
>
> On 22 Apr 2013 07:50, "Barry Warsaw" wrote:
> >
> > On Apr 20, 2013, at 07:10 PM, R. David Murray wrote:
> >
> > >It seems strange to limit a new Python3 feature to the Python2 feature
> > >set. Just saying :)
> >
> > For a critical feature sure,
On 22 Apr 2013 07:50, "Barry Warsaw" wrote:
>
> On Apr 20, 2013, at 07:10 PM, R. David Murray wrote:
>
> >It seems strange to limit a new Python3 feature to the Python2 feature
> >set. Just saying :)
>
> For a critical feature sure, but I don't put __repr__ or enum item
iteration
> order in that
On Apr 22, 2013, at 12:06 AM, Steven D'Aprano wrote:
>On 21/04/13 15:33, Nick Coghlan wrote:
>
>> The PEP is fine, as it already allows duplicate names without encouraging
>> them:
>>
>> class Insect(Enum):
>> wasp = 1 # Preferred. Use this in new code.
>> bee = 2
>>
On Apr 21, 2013, at 03:25 PM, Nick Coghlan wrote:
>Agreed. I think the stdlib enum library should use __prepare__ and
>iterate in definition order (since 2.x compatibility isn't of any
>concern), while flufl.enum can use "sorted by name" as the iteration
>order.
>
>An "order_by_name" keyword argum
Fine with me.
On Sun, Apr 21, 2013 at 2:47 PM, Barry Warsaw wrote:
> On Apr 20, 2013, at 07:10 PM, R. David Murray wrote:
>
>>It seems strange to limit a new Python3 feature to the Python2 feature
>>set. Just saying :)
>
> For a critical feature sure, but I don't put __repr__ or enum item iterat
On Apr 20, 2013, at 07:10 PM, R. David Murray wrote:
>It seems strange to limit a new Python3 feature to the Python2 feature
>set. Just saying :)
For a critical feature sure, but I don't put __repr__ or enum item iteration
order in that category. There's no need for gratuitous incompatibility
e
On 21/04/13 15:33, Nick Coghlan wrote:
The PEP is fine, as it already allows duplicate names without encouraging them:
class Insect(Enum):
wasp = 1 # Preferred. Use this in new code.
bee = 2
ant = 3
# Backwards compatibility aliases
Insect.wsap = Insec
On 21 April 2013 21:02, Greg Ewing wrote:
> Barry Warsaw wrote:
>
>> On Apr 13, 2013, at 12:51 PM, Steven D'Aprano wrote:
>>
>
> class Insect(Enum):
>>>wasp = wsap = 1
>>>bee = 2
>>>ant = 3
>>>
>>> What's the justification for this restriction? I have looked in the PEP,
>>> and
>>> d
Barry Warsaw wrote:
On Apr 13, 2013, at 12:51 PM, Steven D'Aprano wrote:
class Insect(Enum):
wasp = wsap = 1
bee = 2
ant = 3
What's the justification for this restriction? I have looked in the PEP, and
didn't see one.
If you allowed this, there would be no way to look up an enumera
15 matches
Mail list logo