Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-06 Thread Barry Warsaw
On May 05, 2013, at 06:44 AM, Ethan Furman wrote: > to easily create enums when prototyping or at the interactive prompt (I'll > use it all the time -- it's convenient! ;) +1billion (That's literally the number of times I've used the functional API when discussion various aspects of enum behavio

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Antoine Pitrou
On Sun, 5 May 2013 15:27:36 -0700 Eli Bendersky wrote: > > 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: Next time, please try reading the message(s) you are replying to befo

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 4:15 PM, Ethan Furman wrote: > On 05/05/2013 03:16 PM, Nikolaus Rath wrote: >> >> Guido van Rossum writes: 1. Having to enter the values is annoying. Sorry, I read the rationale and all that, and I *still* want to write a C-Like enum { A, B, C }. I fully

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Ethan Furman
On 05/05/2013 03:16 PM, Nikolaus Rath wrote: Guido van Rossum writes: 1. Having to enter the values is annoying. Sorry, I read the rationale and all that, and I *still* want to write a C-Like enum { A, B, C }. I fully expect to edit and reorder enums (if I ever use them) and get irritated with

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Nikolaus Rath
Guido van Rossum writes: >> 1. Having to enter the values is annoying. Sorry, I read the rationale and >> all that, and I *still* want to write a C-Like enum { A, B, C }. I fully >> expect to edit and reorder enums (if I ever use them) and get irritated with >> having to update the value assignmen

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Eli Bendersky
On Sun, May 5, 2013 at 10:46 AM, Antoine Pitrou wrote: > On Sun, 5 May 2013 07:09:14 -0700 > Eli Bendersky wrote: > > On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou > wrote: > > > > > On Sat, 4 May 2013 15:04:49 -0700 > > > Eli Bendersky wrote: > > > > Hello pydev, > > > > > > > > PEP 435 is r

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Paul Moore
On 5 May 2013 18:49, Guido van Rossum wrote: > > Summary - good job, I like the PEP a lot. But Python's enums are very > unlike > > those of other languages, and I suspect that's going to be more of an > issue > > than you'd hope... > > We're pretty confident that we're doing about the best job p

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Steven D'Aprano
On 06/05/13 03:07, Charles-François Natali wrote: I'm chiming in late, but am I the only one who's really bothered by the syntax? class Color(Enum): red = 1 green = 2 blue = 3 I really don't see why one has to provide values, since an enum constant *is* the value. In many cases,

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou 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 t

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
On Sun, May 5, 2013 at 10:41 AM, Paul Moore wrote: > OK, I thought I'd take a look. I have never particularly needed enums in > real life, so I'm reading the PEP from the POV of a naive user who is just > thinking "hey, neat, Python got enums, let's see how they work". I have been > skimming the d

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
This has all long been hashed out, and I've pronounced on this already. I'm sorry you weren't there for the bikeshedding, but nothing you say here is new and it was all considered carefully. On Sun, May 5, 2013 at 10:07 AM, Charles-François Natali wrote: > I'm chiming in late, but am I the only o

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Guido van Rossum
I am fine with adding more information about this issue to the PEP. I am not fine with reopening the issue. I really, really, really have looked at it from all sides and the current design of the functional API has my full blessing. On Sun, May 5, 2013 at 10:46 AM, Antoine Pitrou wrote: > On Sun,

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Antoine Pitrou
On Sun, 5 May 2013 07:09:14 -0700 Eli Bendersky wrote: > On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou wrote: > > > On Sat, 4 May 2013 15:04:49 -0700 > > Eli Bendersky wrote: > > > Hello pydev, > > > > > > PEP 435 is ready for final review. A lot of the feedback from the last > > few > > > wee

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Paul Moore
OK, I thought I'd take a look. I have never particularly needed enums in real life, so I'm reading the PEP from the POV of a naive user who is just thinking "hey, neat, Python got enums, let's see how they work". I have been skimming the discussions and my head has been exploding with the complexit

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Charles-François Natali
I'm chiming in late, but am I the only one who's really bothered by the syntax? class Color(Enum): red = 1 green = 2 blue = 3 I really don't see why one has to provide values, since an enum constant *is* the value. In many cases, there's no natural mapping between an enum constant and

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Philip Jenvey
On May 5, 2013, at 6:44 AM, Ethan Furman wrote: > On 05/05/2013 03:05 AM, Antoine Pitrou 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

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Eli Bendersky
On Sun, May 5, 2013 at 3:05 AM, Antoine Pitrou wrote: > On Sat, 4 May 2013 15:04:49 -0700 > Eli Bendersky 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 Nic

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Victor Stinner
I'm unhappy with this API. I never used it. It is also more verbose than the functional API. Victor Le dimanche 5 mai 2013, Antoine Pitrou a écrit : > On Sat, 4 May 2013 15:04:49 -0700 > Eli Bendersky > wrote: > > Hello pydev, > > > > PEP 435 is ready for final review. A lot of the feedback from

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Ethan Furman
On 05/05/2013 03:05 AM, Antoine Pitrou wrote: On Sat, 4 May 2013 15:04:49 -0700 Eli Bendersky 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

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Antoine Pitrou
On Sun, 05 May 2013 20:59:03 +1000 Steven D'Aprano wrote: > On 05/05/13 20:05, Antoine Pitrou 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 > > -1 > > As alread

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Steven D'Aprano
On 05/05/13 20:05, Antoine Pitrou 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 -1 As already mentioned, this is no substitute for the functional API as it is a statement, not an

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Stefan Behnel
Antoine Pitrou, 05.05.2013 12:05: > On Sat, 4 May 2013 15:04:49 -0700 > Eli Bendersky wrote: >> 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 > functi

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Antoine Pitrou
On Sat, 4 May 2013 15:04:49 -0700 Eli Bendersky 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(

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Eli Bendersky
On Sat, May 4, 2013 at 8:22 PM, Tim Delaney wrote: > On 5 May 2013 13:11, Tim Delaney wrote: > >> @@ -142,6 +152,7 @@ >> if obj_type in (object, Enum): >> enum_item = object.__new__(enum_class) >> else: >> +value = obj_typ

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Tim Delaney
On 5 May 2013 13:32, Ethan Furman wrote: > On 05/04/2013 08:11 PM, Tim Delaney wrote: > >> >> I've been able to achieve the auto-numbering without relying on the >> internal implementation at all (with a >> limitation), with a single change to enum_type.__new__. My previous patch >> was slightl

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Ethan Furman
On 05/04/2013 08:11 PM, Tim Delaney wrote: I've been able to achieve the auto-numbering without relying on the internal implementation at all (with a limitation), with a single change to enum_type.__new__. My previous patch was slightly wrong - fix below as well. All existing tests pass. BTW

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Tim Delaney
On 5 May 2013 13:11, Tim Delaney wrote: > @@ -142,6 +152,7 @@ > if obj_type in (object, Enum): > enum_item = object.__new__(enum_class) > else: > +value = obj_type.__new__(obj_type, value) > enum_item

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Tim Delaney
On 5 May 2013 11:22, Tim Delaney wrote: > On 5 May 2013 10:49, Eli Bendersky wrote: > >> >> On Sat, May 4, 2013 at 4:27 PM, Tim Delaney >> wrote: >> >>> Typo line 171: >>> >>> >> Fixed, thanks. >> >> >> >>> One thing I'd like to be clear in the PEP about is whether enum_type and >>> _EnumDict.

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Tim Delaney
On 5 May 2013 10:49, Eli Bendersky wrote: > > On Sat, May 4, 2013 at 4:27 PM, Tim Delaney > wrote: > >> Typo line 171: >> >> > Fixed, thanks. > > > >> One thing I'd like to be clear in the PEP about is whether enum_type and >> _EnumDict._enum_names should be documented, or whether they're consi

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Eli Bendersky
On Sat, May 4, 2013 at 4:27 PM, Tim Delaney wrote: > Typo line 171: > > Fixed, thanks. > One thing I'd like to be clear in the PEP about is whether enum_type and > _EnumDict._enum_names should be documented, or whether they're considered > implementation details. > > No, they should not. Not o

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Tim Delaney
Typo line 171: One thing I'd like to be clear in the PEP about is whether enum_type and _EnumDict._enum_names should be documented, or whether they're considered implementation details. I'd like to make a subclass of Enum that accepts ... for auto-valued enums but that requires subclassing the m

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Victor Stinner
Great job guys. Victor Le 5 mai 2013 00:06, "Eli Bendersky" a écrit : > Hello pydev, > > PEP 435 is ready for final review. A lot of the feedback from the last few > weeks of discussions has been incorporated. Naturally, not everything could > go in because some minor (mostly preference-based) i

[Python-Dev] PEP 435 - requesting pronouncement

2013-05-04 Thread Eli Bendersky
Hello pydev, PEP 435 is ready for final review. A lot of the feedback from the last few weeks of discussions has been incorporated. Naturally, not everything could go in because some minor (mostly preference-based) issues did not reach a consensus. We do feel, however, that the end result is bette