Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Ethan Furman
On 04/30/2013 09:47 PM, Barry Warsaw wrote: On Apr 30, 2013, at 07:39 PM, Glenn Linderman wrote: Because Guido said no subclassing. Indeed, I heard him. But what I heard was that subclasses shouldn't be allowed to define new enumeration values, and that was the point of all his justification

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

2013-04-30 Thread Ethan Furman
On 04/30/2013 11:18 PM, Barry Warsaw wrote: On Apr 28, 2013, at 11:50 PM, Ethan Furman wrote: But as soon as: type(Color.red) is Color # True type(MoreColor.red) is MoreColor # True then: Color.red is MoreColor.red # must be False, no? If that last statement can still

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

2013-04-30 Thread Barry Warsaw
On Apr 28, 2013, at 11:50 PM, Ethan Furman wrote: >But as soon as: > > type(Color.red) is Color # True > type(MoreColor.red) is MoreColor # True > >then: > >Color.red is MoreColor.red # must be False, no? > > >If that last statement can still be True, I'd love it if someone show

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

2013-04-30 Thread Barry Warsaw
On Apr 29, 2013, at 03:36 PM, Steven D'Aprano wrote: >That's not how I understand it. I expected that the correct way to use >enums is with identity checks: > >if arg is Season.SUMMER: > handle_summer() It's certainly the way I've recommended to use them. I think `is` reads better in conte

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

2013-04-30 Thread Barry Warsaw
On Apr 28, 2013, at 07:46 PM, Ethan Furman wrote: >and similarly, Enum behavior /should be/ (in my opinion ;) > >Season.AUTUMN is Season('AUTUMN') is Season(3) I think you'll have a problem with this. flufl.enum did this, but it has an inherent conflict, which is why we removed the getattr-like

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

2013-04-30 Thread Barry Warsaw
On Apr 29, 2013, at 11:10 AM, Stephen J. Turnbull wrote: >Ethan thinks that "Seasons(3)" is a typecast, not an access into a >mapping (which would be better expressed by "Seasons[3]"). Ie, the >inverse of "int(AUTUMN)". > >This is consistent with the "AUTUMN is-a Seasons" position that Ethan >and

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-30 Thread Barry Warsaw
On Apr 30, 2013, at 06:00 AM, Steven D'Aprano wrote: >flufl.enum has been in use for Mailman for many years, and I would like to >hear Barry's opinion on this. I'm not sure it matters now (I'm about a billion messages behind with little hope of catching up), but FWIW, I have use cases for extendi

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Barry Warsaw
On Apr 30, 2013, at 09:19 PM, Ethan Furman wrote: >Subclassing an implemented Enum class now raises an error (is there a better >word than 'implemented'?) > >--> class MoreColor(Color): >... cyan = 4 >... magenta = 5 >... yellow = 6 > >Traceback (most recent call last): > File "", li

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Barry Warsaw
On Apr 30, 2013, at 07:39 PM, Glenn Linderman wrote: >>> Because Guido said no subclassing. > >Indeed, I heard him. But what I heard was that subclasses shouldn't be >allowed to define new enumeration values, and that was the point of all his >justification and the justifications in the Stack Ove

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Ethan Furman
Latest code available at https://bitbucket.org/stoneleaf/aenum. --> class Color(Enum): ... red = 1 ... green = 2 ... blue = 3 Enum items are virtual attributes looked by EnumType's __getattr__. The win here is that --> Color.red.green.blue no longer works. ;) Subclassing an imp

Re: [Python-Dev] Destructors and Closing of File Objects

2013-04-30 Thread Nikolaus Rath
Armin Rigo writes: > Hi Jeff, > > On Mon, Apr 29, 2013 at 11:58 PM, Jeff Allen <"ja...py"@farowl.co.uk> wrote: >> In Jython, (...) > > Thanks Jeff for pointing this out. Jython thus uses a custom > mechanism similar to PyPy's, which is also similar to atexit's. It > should not be too hard to imp

Re: [Python-Dev] enum instances

2013-04-30 Thread Nikolaus Rath
On 04/30/2013 07:05 PM, Nikolaus Rath wrote: > Larry Hastings writes: >> On 04/29/2013 07:42 PM, Nikolaus Rath wrote: >>> State is a class, it just inherits from enum. Thus: >>> >>> type(State) == type(enum) == type(EnumMetaclass) >>> issubclass(State, enum) == True >>> >> >> If you'd tried it, yo

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Glenn Linderman
On 4/30/2013 4:49 PM, Ethan Furman wrote: On 04/30/2013 03:34 PM, Ethan Furman wrote: On 04/30/2013 03:24 PM, Glenn Linderman wrote: On 4/30/2013 1:12 PM, Ethan Furman wrote: Greetings, Eli asked me to put the reference implementation here for review. It is available at https://bitbucket.org

Re: [Python-Dev] enum instances

2013-04-30 Thread Ethan Furman
On 04/30/2013 07:05 PM, Nikolaus Rath wrote: Larry Hastings writes: On 04/29/2013 07:42 PM, Nikolaus Rath wrote: State is a class, it just inherits from enum. Thus: type(State) == type(enum) == type(EnumMetaclass) issubclass(State, enum) == True HTH, -Nikolaus If you'd tried it, you

Re: [Python-Dev] enum instances

2013-04-30 Thread Larry Hastings
On 04/30/2013 07:05 PM, Nikolaus Rath wrote: Larry Hastings writes: On 04/29/2013 07:42 PM, Nikolaus Rath wrote: State is a class, it just inherits from enum. Thus: type(State) == type(enum) == type(EnumMetaclass) issubclass(State, enum) == True HTH, -Nikolaus If you'd tried it, you'

Re: [Python-Dev] enum instances

2013-04-30 Thread Nikolaus Rath
Larry Hastings writes: > On 04/29/2013 07:42 PM, Nikolaus Rath wrote: >> State is a class, it just inherits from enum. Thus: >> >> type(State) == type(enum) == type(EnumMetaclass) >> issubclass(State, enum) == True >> >> >> HTH, >> >> -Nikolaus > > If you'd tried it, you'd have found that that

Re: [Python-Dev] Enumeration items: mixed types?

2013-04-30 Thread Tim Delaney
On 1 May 2013 02:27, Eli Bendersky wrote: > > > > On Mon, Apr 29, 2013 at 5:38 PM, Greg Ewing > wrote: > >> Ethan Furman wrote: >> >>> I suppose the other option is to have `.value` be whatever was assigned >>> (1, 'really big country', and (8273.199, 517) ), >>> >> >> I thought that was the int

[Python-Dev] Biggest Fake Conference in Computer Science

2013-04-30 Thread eliswilson
Biggest Fake Conference in Computer Science We are researchers from different parts of the world and conducted a study on the world’s biggest bogus computer science conference WORLDCOMP http://sites.google.com/site/worlddump1 organized by Prof. Hamid Arabnia from University of Georgia, USA.

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Ethan Furman
On 04/30/2013 03:34 PM, Ethan Furman wrote: On 04/30/2013 03:24 PM, Glenn Linderman wrote: On 4/30/2013 1:12 PM, Ethan Furman wrote: Greetings, Eli asked me to put the reference implementation here for review. It is available at https://bitbucket.org/stoneleaf/aenum in ref435.py and test_ref

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Ethan Furman
On 04/30/2013 03:24 PM, Glenn Linderman wrote: On 4/30/2013 1:12 PM, Ethan Furman wrote: Greetings, Eli asked me to put the reference implementation here for review. It is available at https://bitbucket.org/stoneleaf/aenum in ref435.py and test_ref435.py Thanks for the code reference. Test

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-30 Thread Philip Jenvey
On Apr 27, 2013, at 6:09 PM, Guido van Rossum wrote: > On Sat, Apr 27, 2013 at 5:10 PM, Ethan Furman wrote: >> class Planet( >> Enum, >> names=''' >> MERCURY >> VENUS >> EARTH >> MARS >>

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Glenn Linderman
On 4/30/2013 1:12 PM, Ethan Furman wrote: Greetings, Eli asked me to put the reference implementation here for review. It is available at https://bitbucket.org/stoneleaf/aenum in ref435.py and test_ref435.py Thanks for the code reference. Tests ran fine here on Python 3.3 If I alter test_r

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Ethan Furman
On 04/30/2013 01:12 PM, Ethan Furman wrote: It is available at https://bitbucket.org/stoneleaf/aenum in ref435.py and test_ref435.py Oh, as written in requires 3.3+. If you want to play around with it and are stuck on an earlier version, remove the `from None` on line 68. -- ~Ethan~ _

Re: [Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Eli Bendersky
On Tue, Apr 30, 2013 at 1:12 PM, Ethan Furman wrote: > Greetings, > > Eli asked me to put the reference implementation here for review. > > It is available at https://bitbucket.org/stoneleaf/aenum in ref435.py and > test_ref435.py > Thanks, Ethan. All - note that strictly speaking this impleme

Re: [Python-Dev] Regression fix releases coming

2013-04-30 Thread Guido van Rossum
Sorry, that was my confusion. The virus warnings were about the bz2 test data. XML bombs have not yet been addressed in any revision AFAIK. On Tue, Apr 30, 2013 at 2:06 PM, Nadeem Vawda wrote: > On Tue, Apr 30, 2013 at 4:07 PM, Benjamin Peterson > wrote: >> >> 2013/4/30 Guido van Rossum : >> > C

Re: [Python-Dev] Regression fix releases coming

2013-04-30 Thread Nadeem Vawda
On Tue, Apr 30, 2013 at 4:07 PM, Benjamin Peterson wrote: > 2013/4/30 Guido van Rossum : > > Can we do something about the problem that virus checkers complain about > the > > xml bomb test file? E.g. Generate it dynamically in a script? > > That's been dealt with. See http://bugs.python.org/issue

[Python-Dev] PEP-435 reference implementation

2013-04-30 Thread Ethan Furman
Greetings, Eli asked me to put the reference implementation here for review. It is available at https://bitbucket.org/stoneleaf/aenum in ref435.py and test_ref435.py -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/

Re: [Python-Dev] Enumeration items: mixed types?

2013-04-30 Thread Eli Bendersky
On Mon, Apr 29, 2013 at 5:38 PM, Greg Ewing wrote: > Ethan Furman wrote: > >> I suppose the other option is to have `.value` be whatever was assigned >> (1, 'really big country', and (8273.199, 517) ), >> > > I thought that was the intention all along, and that we'd > given up on the idea of auto-

Re: [Python-Dev] Enumeration items: mixed types?

2013-04-30 Thread Ethan Furman
On 04/29/2013 05:38 PM, Greg Ewing wrote: Ethan Furman wrote: I suppose the other option is to have `.value` be whatever was assigned (1, 'really big country', and (8273.199, 517) ), I thought that was the intention all along, and that we'd given up on the idea of auto-assigning integer value

Re: [Python-Dev] Regression fix releases coming

2013-04-30 Thread Benjamin Peterson
2013/4/30 Guido van Rossum : > Can we do something about the problem that virus checkers complain about the > xml bomb test file? E.g. Generate it dynamically in a script? That's been dealt with. See http://bugs.python.org/issue17843 -- Regards, Benjamin __

Re: [Python-Dev] Regression fix releases coming

2013-04-30 Thread Guido van Rossum
Can we do something about the problem that virus checkers complain about the xml bomb test file? E.g. Generate it dynamically in a script? On Tuesday, April 30, 2013, Georg Brandl wrote: > Hi all, > > since there turned out to be a "critical mass" of regressions in 2.7.4/ > 3.2.4/3.3.1, Benjamin

Re: [Python-Dev] Getting a list of registered codecs

2013-04-30 Thread Paul Moore
On 30 April 2013 10:42, M.-A. Lemburg wrote: > It would be possible to get a list of registered codec search functions, > but there's no API to ask the search functions for a list of supported > codecs. > OK, so there's no way to determine in advance what values of enc will work in bytestr.decod

Re: [Python-Dev] Getting a list of registered codecs

2013-04-30 Thread M.-A. Lemburg
On 30.04.2013 11:52, Paul Moore wrote: > On 30 April 2013 10:42, M.-A. Lemburg wrote: > >> It would be possible to get a list of registered codec search functions, >> but there's no API to ask the search functions for a list of supported >> codecs. >> > > OK, so there's no way to determine in ad

Re: [Python-Dev] Getting a list of registered codecs

2013-04-30 Thread M.-A. Lemburg
On 30.04.2013 11:15, Paul Moore wrote: > Before I raise a bug for this, can someone confirm if I've simply missed > something? I don't see any way, either in the docs or in the helpstrings > from the codecs, of listing the codecs that have been registered. > > FWIW, I picked this up when I was loo

Re: [Python-Dev] Getting a list of registered codecs

2013-04-30 Thread Steven D'Aprano
On Tue, Apr 30, 2013 at 10:15:58AM +0100, Paul Moore wrote: > Before I raise a bug for this, can someone confirm if I've simply missed > something? I don't see any way, either in the docs or in the helpstrings > from the codecs, of listing the codecs that have been registered. > > FWIW, I picked t

[Python-Dev] Getting a list of registered codecs

2013-04-30 Thread Paul Moore
Before I raise a bug for this, can someone confirm if I've simply missed something? I don't see any way, either in the docs or in the helpstrings from the codecs, of listing the codecs that have been registered. FWIW, I picked this up when I was looking at writing a simple encoding converter, and

Re: [Python-Dev] Destructors and Closing of File Objects

2013-04-30 Thread Armin Rigo
Hi Jeff, On Mon, Apr 29, 2013 at 11:58 PM, Jeff Allen <"ja...py"@farowl.co.uk> wrote: > In Jython, (...) Thanks Jeff for pointing this out. Jython thus uses a custom mechanism similar to PyPy's, which is also similar to atexit's. It should not be too hard to implement it in CPython 3 as well, i

[Python-Dev] Regression fix releases coming

2013-04-30 Thread Georg Brandl
Hi all, since there turned out to be a "critical mass" of regressions in 2.7.4/ 3.2.4/3.3.1, Benjamin and I would like to release a releasing fixing these next weekend. Since we would like to cherry-pick only regression fixes into these releases, please make sure any regression issues you know of