Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Antoine Pitrou
Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan a écrit : > > > > The other issue is your proposal to have a class-based convenience > > syntax > akin to (correct me if I got this wrong): > > > > class Animal(Enum): > > __values__ = 'cat dog' > > I would suggest moving the field names into the

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Antoine Pitrou
Le Thu, 2 May 2013 14:57:35 -0700, Eli Bendersky a écrit : > > class Animal(Enum): > __values__ = 'cat dog' > > This is obviously a matter of preference (and hence bikeshedding), > but this still looks better to me: > > Animal = Enum('Animal', 'cat dog') > > It has two advantages: > > 1. Sh

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Steven D'Aprano
On 03/05/13 18:42, Antoine Pitrou wrote: Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan a écrit : I would suggest moving the field names into the class header for a class based convenience API: class Animal(Enum, members='cat dog'): pass This looks good to me (assuming some people don't l

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Antoine Pitrou
Le Fri, 03 May 2013 19:40:21 +1000, Steven D'Aprano a écrit : > On 03/05/13 18:42, Antoine Pitrou wrote: > > Le Fri, 3 May 2013 09:14:22 +1000, > > Nick Coghlan a écrit : > > >> I would suggest moving the field names into the class header for a > >> class based convenience API: > >> > >> class A

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Stefan Behnel
Ethan Furman, 02.05.2013 21:07: > In order for the Enum convenience function to be pickleable, we have this > line of code in the metaclass: > > enum_class.__module__ = sys._getframe(1).f_globals['__name__'] What a hack. And fragile, too. > This works fine for Cpython, but what about the ot

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Paul Moore
On 2 April 2013 01:47, Daniel Holth wrote: > This PEP proposes to fix these problems by re-publicising the feature, > defining the .pyz and .pyzw extensions as “Python ZIP Applications” > and “Windowed Python ZIP Applications”, and providing some simple > tooling to manage the format. > There is

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Nick Coghlan
On 3 May 2013 20:40, "Paul Moore" wrote: > > On 2 April 2013 01:47, Daniel Holth wrote: >> >> This PEP proposes to fix these problems by re-publicising the feature, >> defining the .pyz and .pyzw extensions as “Python ZIP Applications” >> and “Windowed Python ZIP Applications”, and providing some

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Greg Ewing
Barry Warsaw wrote: I still don't get it why this is an issue though, or at least why this is different than any other getattr on any other class, It's not a problem that getattr() has this behaviour. What I'm questioning is the idea that getattr() should be the only provided way of doing a nam

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Eli Bendersky
On Fri, May 3, 2013 at 6:34 AM, Greg Ewing wrote: > Barry Warsaw wrote: > >> I still don't get it why this is an issue though, or at least why this is >> different than any other getattr on any other class, >> > > It's not a problem that getattr() has this behaviour. > What I'm questioning is the

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Guido van Rossum
On Fri, May 3, 2013 at 7:14 AM, Eli Bendersky wrote: > I'm just curious what it is about enums that sets everyone on a "let's make > things safer" path. Python is about duck typing, it's absolutely "unsafe" in > the static typing sense, in the most fundamental ways imaginable. When > programmatica

[Python-Dev] Summary of Python tracker Issues

2013-05-03 Thread Python tracker
ACTIVITY SUMMARY (2013-04-26 - 2013-05-03) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open3953 ( +4) closed 25714 (+40) total 29667 (+44) Open issues wit

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Barry Warsaw
On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote: >The problem is that this is not an expression, it is a statement. The >advantage of the convenience function is not just that it is shorter, but >that it is an expression. Exactly right, but let's stop calling it the "convenience API" and inst

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Guido van Rossum
On Fri, May 3, 2013 at 9:08 AM, Barry Warsaw wrote: > On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote: > >>The problem is that this is not an expression, it is a statement. The >>advantage of the convenience function is not just that it is shorter, but >>that it is an expression. > > Exactly r

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Piotr Duda
2013/5/3 Barry Warsaw : > On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote: > >>The problem is that this is not an expression, it is a statement. The >>advantage of the convenience function is not just that it is shorter, but >>that it is an expression. > > Exactly right, but let's stop calling

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Georg Brandl
Am 03.05.2013 11:40, schrieb Steven D'Aprano: > On 03/05/13 18:42, Antoine Pitrou wrote: >> Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan a >> écrit : > >>> I would suggest moving the field names into the class header for a class >>> based convenience API: >>> >>> class Animal(Enum, members='c

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Terry Jan Reedy
On 5/3/2013 12:08 PM, Barry Warsaw wrote: Exactly right, but let's stop calling it the "convenience API" and instead call it the "functional API". I probably started the perpetuation of this problem; let's update the PEP. Please do. To me, a 'convenience function' is something like the timeit

[Python-Dev] PEP 379 Python launcher for Windows - behaviour for #!/usr/bin/env python line is wrong

2013-05-03 Thread Paul Moore
While reviewing the behaviour of Vinay's "distil" installer tool (see distutils-sig for details, but it's not relevant here) I have found what I think is a flaw in the behaviour of the py.exe launcher for Windows. To recap for people unfamiliar with the launcher, it emulates #! line interpretation

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Greg Ewing
Guido van Rossum wrote: I haven't seen code in the style that Greg proposes in decades, What style are you talking about here? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Greg Ewing
Eli Bendersky wrote: I'm just curious what it is about enums that sets everyone on a "let's make things safer" path. Python is about duck typing, it's absolutely "unsafe" in the static typing sense, in the most fundamental ways imaginable. This isn't about catching bugs in the program, it's a

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Antoine Pitrou
On Sat, 04 May 2013 11:15:17 +1200 Greg Ewing wrote: > Eli Bendersky wrote: > > I'm just curious what it is about enums that sets everyone on a "let's > > make things safer" path. Python is about duck typing, it's absolutely > > "unsafe" in the static typing sense, in the most fundamental ways

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Guido van Rossum
On Fri, May 3, 2013 at 4:08 PM, Greg Ewing wrote: > Guido van Rossum wrote: >> >> I haven't seen code in the style that >> Greg proposes in decades, > What style are you talking about here? Code that wants to validate a string the user typed as input. Web forms just don't work that way. (Command

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Steven D'Aprano
On 03/05/13 20:37, Paul Moore wrote: On 2 April 2013 01:47, Daniel Holth wrote: This PEP proposes to fix these problems by re-publicising the feature, defining the .pyz and .pyzw extensions as “Python ZIP Applications” and “Windowed Python ZIP Applications”, and providing some simple tooling t

Re: [Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Nick Coghlan
On 4 May 2013 05:17, "Georg Brandl" wrote: > > Am 03.05.2013 11:40, schrieb Steven D'Aprano: > > On 03/05/13 18:42, Antoine Pitrou wrote: > >> Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan a > >> écrit : > > > >>> I would suggest moving the field names into the class header for a class > >>> ba

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Nick Coghlan
On 4 May 2013 00:17, "Eli Bendersky" wrote: > > > > > On Fri, May 3, 2013 at 6:34 AM, Greg Ewing wrote: >> >> Barry Warsaw wrote: >>> >>> I still don't get it why this is an issue though, or at least why this is >>> different than any other getattr on any other class, >> >> >> It's not a problem

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Nick Coghlan
On 4 May 2013 09:34, "Guido van Rossum" wrote: > > On Fri, May 3, 2013 at 4:08 PM, Greg Ewing wrote: > > Guido van Rossum wrote: > >> > >> I haven't seen code in the style that > >> Greg proposes in decades, > > > What style are you talking about here? > > Code that wants to validate a string the

Re: [Python-Dev] PEP 379 Python launcher for Windows - behaviour for #!/usr/bin/env python line is wrong

2013-05-03 Thread Brian Curtin
On Fri, May 3, 2013 at 3:23 PM, Paul Moore wrote: > I would propose that the behaviour of the launcher on Windows should be > changed when it encounters specifically the hashbang line #!/usr/bin/env > python. In that case, it should search PATH for a copy of python.exe, and if > it finds one, use

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Glenn Linderman
On 5/3/2013 6:41 PM, Steven D'Aprano wrote: Many official Microsoft file extensions are four or more letters, e.g. docx. I don't see any value in making long-lasting decisions on file extensions based on (transient?) bugs that aren't our responsibility. +1

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Stephen J. Turnbull
Steven D'Aprano writes: > > Rather than risk obscure bugs, I would suggest restricting the extensions > > to 3 characters. For the “Windowed Python ZIP Applications” case, could we > > use .pzw as the extension instead of .pyzw? +0 > Many official Microsoft file extensions are four or more l

Re: [Python-Dev] PEP 379 Python launcher for Windows - behaviour for #!/usr/bin/env python line is wrong

2013-05-03 Thread Nick Coghlan
On Sat, May 4, 2013 at 12:18 PM, Brian Curtin wrote: > On Fri, May 3, 2013 at 3:23 PM, Paul Moore wrote: >> I would propose that the behaviour of the launcher on Windows should be >> changed when it encounters specifically the hashbang line #!/usr/bin/env >> python. In that case, it should search

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Georg Brandl
Am 04.05.2013 01:22, schrieb Antoine Pitrou: > On Sat, 04 May 2013 11:15:17 +1200 > Greg Ewing wrote: >> Eli Bendersky wrote: >> > I'm just curious what it is about enums that sets everyone on a "let's >> > make things safer" path. Python is about duck typing, it's absolutely >> > "unsafe" in th

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Steven D'Aprano
On 04/05/13 15:13, Stephen J. Turnbull wrote: Steven D'Aprano writes: > > Rather than risk obscure bugs, I would suggest restricting the extensions > > to 3 characters. For the “Windowed Python ZIP Applications” case, could we > > use .pzw as the extension instead of .pyzw? +0 > Many o

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Nick Coghlan
On Sat, May 4, 2013 at 4:10 PM, Georg Brandl wrote: > Am 04.05.2013 01:22, schrieb Antoine Pitrou: >> On Sat, 04 May 2013 11:15:17 +1200 >> Greg Ewing wrote: >>> Eli Bendersky wrote: >>> > I'm just curious what it is about enums that sets everyone on a "let's >>> > make things safer" path. Python

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Greg Ewing
Guido van Rossum wrote: Code that wants to validate a string the user typed as input. Web forms just don't work that way. Maybe "validation" was a misleading term to use. To be more precise, I'm talking about taking input to the program (it needn't come directly from a user, it could be read fr

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-05-03 Thread Greg Ewing
Nick Coghlan wrote: 1. The current PEP, offering only "getattr(MyEnum, name)". > 2. We restore __getitem__ on EnumMetaclass *solely* for member lookup by name 3. Use keyword arguments to distinguish two different ways of calling the enum class: MyEnum(value = 1) --> lookup by value MyE

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Nick Coghlan
On Sat, May 4, 2013 at 4:15 PM, Steven D'Aprano wrote: > On 04/05/13 15:13, Stephen J. Turnbull wrote: >> >> Steven D'Aprano writes: >> >> > > Rather than risk obscure bugs, I would suggest restricting the >> extensions >> > > to 3 characters. For the “Windowed Python ZIP Applications” case, >