Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Eli Bendersky
On Tue, May 7, 2013 at 6:00 PM, Steven D'Aprano wrote: > On 07/05/13 23:34, Eli Bendersky wrote: > >> One of the contended issues with PEP 435 on which Guido pronounced was the >> functional API, that allows created enumerations dynamically in a manner >> similar to namedtuple: >> >>Color = E

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Steven D'Aprano
On 07/05/13 23:34, Eli Bendersky wrote: One of the contended issues with PEP 435 on which Guido pronounced was the functional API, that allows created enumerations dynamically in a manner similar to namedtuple: Color = Enum('Color', 'red blue green') The biggest complaint reported against th

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Larry Hastings
On 05/07/2013 08:47 AM, Eli Bendersky wrote: def Color = Enum('red green blue') It's an interesting idea, but as NIck suggested we should probably discuss it on the python-ideas list. [...] A special syntax raises more questions though, because it has to be defined very precisely. Feel

Re: [Python-Dev] All 3.x stable buildbots are red

2013-05-07 Thread Antoine Pitrou
On Tue, 7 May 2013 09:34:45 +0200 Victor Stinner wrote: > http://buildbot.python.org/all/waterfall?category=3.x.stable > > x86 Windows Server 2003 [SB] 3.x: 3 tests failed, test___all__ test_gc > test_ssl > x86 Windows7 3.x: 3 tests failed, test___all__ test_gc test_ssl > x86 Gentoo Non-Debug 3.

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Michael Urman
On Tue, May 7, 2013 at 8:34 AM, Eli Bendersky wrote: > According to an earlier discussion, this is works on CPython, PyPy and > Jython, but not on IronPython. The alternative that works everywhere is to > define the Enum like this: > > Color = Enum('the_module.Color', 'red blue green') > > The

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Eli Bendersky
On Tue, May 7, 2013 at 9:14 AM, Antoine Pitrou wrote: > Le Tue, 7 May 2013 08:44:46 -0700, > Eli Bendersky a écrit : > > > > 4) Using _getframe(N) here seems like an overkill to me. > > > > > > It's not just overkill, it's fragile - it only works if you call the > > > constructor directly. If y

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Antoine Pitrou
Le Tue, 7 May 2013 08:44:46 -0700, Eli Bendersky a écrit : > > > 4) Using _getframe(N) here seems like an overkill to me. > > > > It's not just overkill, it's fragile - it only works if you call the > > constructor directly. If you use a convenience function in a utility > > module, it will try t

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Ethan Furman
On 05/07/2013 08:03 AM, Nick Coghlan wrote: On Tue, May 7, 2013 at 11:34 PM, Eli Bendersky wrote: 4) Using _getframe(N) here seems like an overkill to me. It's not just overkill, it's fragile - it only works if you call the constructor directly. If you use a convenience function in a utility

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Eli Bendersky
On Tue, May 7, 2013 at 8:35 AM, Piotr Duda wrote: > 2013/5/7 Ethan Furman : > > On 05/07/2013 08:01 AM, Piotr Duda wrote: > >> > >> 2013/5/7 Ethan Furman : > >>> > >>> On 05/07/2013 07:48 AM, Piotr Duda wrote: > > > > What about adding simple syntax (I proposed this earlier, b

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Xavier Morel
On 2013-05-07, at 17:03 , Nick Coghlan wrote: > > Specifically, what I'm talking about is some kind of implicit context > similar to the approach the decimal module uses to control operations > on Decimal instances. Wouldn't it be a good occasion to add actual, full-fledged and correctly implemen

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Eli Bendersky
On Tue, May 7, 2013 at 8:03 AM, Nick Coghlan wrote: > On Tue, May 7, 2013 at 11:34 PM, Eli Bendersky wrote: > > One of the contended issues with PEP 435 on which Guido pronounced was > the > > functional API, that allows created enumerations dynamically in a manner > > similar to namedtuple: > >

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Piotr Duda
2013/5/7 Ethan Furman : > On 05/07/2013 08:01 AM, Piotr Duda wrote: >> >> 2013/5/7 Ethan Furman : >>> >>> On 05/07/2013 07:48 AM, Piotr Duda wrote: What about adding simple syntax (I proposed this earlier, but no one commented) that take care of assigning name and module, s

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Ethan Furman
On 05/07/2013 08:01 AM, Piotr Duda wrote: 2013/5/7 Ethan Furman : On 05/07/2013 07:48 AM, Piotr Duda wrote: What about adding simple syntax (I proposed this earlier, but no one commented) that take care of assigning name and module, something like: def name = expression which would be rough

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Antoine Pitrou
Le Wed, 8 May 2013 01:03:38 +1000, Nick Coghlan a écrit : > > What if there was a variant of the class statement that bound the > result of a function call rather than using the normal syntax: > > class Animal from enum.Enum(members="dog cat bear") Apparently you're trying hard to invent sy

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Nick Coghlan
On Wed, May 8, 2013 at 12:53 AM, Ethan Furman wrote: > On 05/07/2013 07:48 AM, Piotr Duda wrote: >> >> >> What about adding simple syntax (I proposed this earlier, but no one >> commented) that take care of assigning name and module, something >> like: >> >> def name = expression >> >> which would

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Nick Coghlan
On Tue, May 7, 2013 at 11:34 PM, Eli Bendersky wrote: > One of the contended issues with PEP 435 on which Guido pronounced was the > functional API, that allows created enumerations dynamically in a manner > similar to namedtuple: > > Color = Enum('Color', 'red blue green') > > The biggest compl

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Piotr Duda
2013/5/7 Ethan Furman : > On 05/07/2013 07:48 AM, Piotr Duda wrote: >> >> >> What about adding simple syntax (I proposed this earlier, but no one >> commented) that take care of assigning name and module, something >> like: >> >> def name = expression >> >> which would be rough equivalent for: >> >

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Ethan Furman
On 05/07/2013 07:48 AM, Piotr Duda wrote: What about adding simple syntax (I proposed this earlier, but no one commented) that take care of assigning name and module, something like: def name = expression which would be rough equivalent for: name = expression name.__name__ = 'name' name.__mod

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Piotr Duda
2013/5/7 Eli Bendersky : > > 4) Using _getframe(N) here seems like an overkill to me. What we really need > is just the module in which the current execution currently is (i.e. the > metaclass's __new__ in our case). Would it make sense to add a new function > somewhere in the stdlib of 3.4 (in sys

Re: [Python-Dev] Fighting the theoretical randomness of "is" on immutables

2013-05-07 Thread Nick Coghlan
On Tue, May 7, 2013 at 6:27 PM, Armin Rigo wrote: > Hi Antoine, > > On Tue, May 7, 2013 at 8:25 AM, Antoine Pitrou wrote: >> For me, a patch that mandated general-purpose containers (list, dict, >> etc.) respect object identity would be ok. > > Thanks, that's also my opinion. > > In PyPy's approa

[Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Eli Bendersky
One of the contended issues with PEP 435 on which Guido pronounced was the functional API, that allows created enumerations dynamically in a manner similar to namedtuple: Color = Enum('Color', 'red blue green') The biggest complaint reported against this API is interaction with pickle. As promi

Re: [Python-Dev] PEP 435: initial values must be specified? Yes

2013-05-07 Thread Ethan Furman
On 05/06/2013 10:18 PM, Tim Delaney wrote: On 7 May 2013 15:14, Tim Delaney mailto:timothy.c.dela...@gmail.com>> wrote: Unfortunately, if you subclass AutoNumber from IntEnum it breaks. -- Run Python3 -- Traceback (most recent call last): File "D:\home\repos\m

Re: [Python-Dev] Fighting the theoretical randomness of "is" on immutables

2013-05-07 Thread Armin Rigo
Hi Antoine, On Tue, May 7, 2013 at 8:25 AM, Antoine Pitrou wrote: > For me, a patch that mandated general-purpose containers (list, dict, > etc.) respect object identity would be ok. Thanks, that's also my opinion. In PyPy's approach, in trying to emulate CPython vs. trying to convince users th

[Python-Dev] All 3.x stable buildbots are red

2013-05-07 Thread Victor Stinner
http://buildbot.python.org/all/waterfall?category=3.x.stable x86 Windows Server 2003 [SB] 3.x: 3 tests failed, test___all__ test_gc test_ssl x86 Windows7 3.x: 3 tests failed, test___all__ test_gc test_ssl x86 Gentoo Non-Debug 3.x: 3 tests failed, test_logging test_multiprocessing test_urllib2net x