Re: [Python-Dev] class name spaces inside an outer function

2013-04-28 Thread Greg Ewing
Guido van Rossum wrote: On Saturday, April 27, 2013, Greg Ewing wrote: class Planet(Enum): MERCURY = (3.303e+23, 2.4397e6) VENUS = (4.869e+24, 6.0518e6) EARTH = (5.976e+24, 6.37814e6) def __init__(self, mass, radius): self.mass = mass

Re: [Python-Dev] class name spaces inside an outer function

2013-04-28 Thread Ethan Furman
On 04/27/2013 09:20 PM, Guido van Rossum wrote: On Saturday, April 27, 2013, Greg Ewing wrote: class Planet(Enum): MERCURY = (3.303e+23, 2.4397e6) VENUS = (4.869e+24, 6.0518e6) EARTH = (5.976e+24, 6.37814e6) MARS= (6.421e+23, 3.3972e6) JUPITER = (1.9e+27, 7.1

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Ethan Furman
On 04/27/2013 09:20 PM, Guido van Rossum wrote: On Saturday, April 27, 2013, Greg Ewing wrote: This whole business can be avoided by doing things differently in the first place. Instead of initialising the enum items by calling the class, just assign a tuple of args to the name a

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Guido van Rossum
On Saturday, April 27, 2013, Greg Ewing wrote: > > This whole business can be avoided by doing things differently > in the first place. Instead of initialising the enum items by > calling the class, just assign a tuple of args to the name > and have the metaclass make the constructor call. > > cl

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Benjamin Peterson
2013/4/27 Nick Coghlan : > On Sun, Apr 28, 2013 at 11:38 AM, Benjamin Peterson > wrote: >> 2013/4/27 Nick Coghlan : >>> >>> On 28 Apr 2013 04:30, "Ethan Furman" wrote: I filed bug http://bugs.python.org/issue17853 last night. If somebody could point me in the right direction

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Nick Coghlan
On Sun, Apr 28, 2013 at 11:38 AM, Benjamin Peterson wrote: > 2013/4/27 Nick Coghlan : >> >> On 28 Apr 2013 04:30, "Ethan Furman" wrote: >>> >>> I filed bug http://bugs.python.org/issue17853 last night. >>> >>> If somebody could point me in the right direction (mainly which files to >>> look in),

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Ethan Furman
On 04/27/2013 07:01 PM, Greg Ewing wrote: PJ Eby wrote: On Sat, Apr 27, 2013 at 2:27 PM, Ethan Furman wrote: I filed bug http://bugs.python.org/issue17853 last night. About the only workaround I can see is to put "Season = Season" at the top of a class that uses this inside a function defi

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Greg Ewing
PJ Eby wrote: On Sat, Apr 27, 2013 at 2:27 PM, Ethan Furman wrote: I filed bug http://bugs.python.org/issue17853 last night. About the only workaround I can see is to put "Season = Season" at the top of a class that uses this inside a function definition, This whole business can be avoide

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Benjamin Peterson
2013/4/27 Nick Coghlan : > > On 28 Apr 2013 04:30, "Ethan Furman" wrote: >> >> I filed bug http://bugs.python.org/issue17853 last night. >> >> If somebody could point me in the right direction (mainly which files to >> look in), I'd be happy to attempt a patch. > > Hmm, interesting challenge. A ke

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Nick Coghlan
On 28 Apr 2013 04:30, "Ethan Furman" wrote: > > I filed bug http://bugs.python.org/issue17853 last night. > > If somebody could point me in the right direction (mainly which files to look in), I'd be happy to attempt a patch. Hmm, interesting challenge. A key part of the problem is that the 3.x c

Re: [Python-Dev] class name spaces inside an outer function

2013-04-27 Thread PJ Eby
On Sat, Apr 27, 2013 at 2:27 PM, Ethan Furman wrote: > I filed bug http://bugs.python.org/issue17853 last night. > > If somebody could point me in the right direction (mainly which files to > look in), I'd be happy to attempt a patch. Wow. I had no idea Python actually did this (override class-l

[Python-Dev] class name spaces inside an outer function

2013-04-27 Thread Ethan Furman
I filed bug http://bugs.python.org/issue17853 last night. If somebody could point me in the right direction (mainly which files to look in), I'd be happy to attempt a patch. -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyth