Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Ethan Furman
On 02/18/2014 11:53 AM, Serhiy Storchaka wrote: 18.02.14 21:20, Guido van Rossum написав(ла): I'm confused. AFAICT enums are pickled by value too. What am I missing? Are we confused about terminology or about behavior? (I'm just guessing that the pickling happens by value because I don't see the

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Ethan Furman
On 02/18/2014 11:37 AM, Guido van Rossum wrote: Well, I'm against that. Given the lack of a tidal wave of support for the idea, I'll let it die with that. Still, many thanks to Serhiy for greatly improving the way pickling is implemented for Enums, even using values. -- ~Ethan~ ___

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Guido van Rossum
Well, I still think it should be done by value. On Tue, Feb 18, 2014 at 11:53 AM, Serhiy Storchaka wrote: > 18.02.14 21:20, Guido van Rossum написав(ла): > > I'm confused. AFAICT enums are pickled by value too. What am I missing? >> Are we confused about terminology or about behavior? (I'm just

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Serhiy Storchaka
18.02.14 21:20, Guido van Rossum написав(ла): I'm confused. AFAICT enums are pickled by value too. What am I missing? Are we confused about terminology or about behavior? (I'm just guessing that the pickling happens by value because I don't see the string AF_INET.) Pickling was not even working

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Ethan Furman
On 02/18/2014 11:20 AM, Guido van Rossum wrote: I'm confused. AFAICT enums are pickled by value too. What am I missing? Are we confused about terminology or about behavior? (I'm just guessing that the pickling happens by value because I don't see the string AF_INET.) There's an open issue [1

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Serhiy Storchaka
18.02.14 20:16, Ethan Furman написав(ла): This conversation wasn't in the PEP, but as I recall we decided to go with value instead of name for json because the receiving end may not be running Python. Is having json do it one way and pickle another a problem? We decided to go with value instea

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Guido van Rossum
Well, I'm against that. On Tue, Feb 18, 2014 at 11:26 AM, Ethan Furman wrote: > On 02/18/2014 11:20 AM, Guido van Rossum wrote: > >> >> I'm confused. AFAICT enums are pickled by value too. What am I missing? >> Are we confused about terminology or about >> behavior? (I'm just guessing that the

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Guido van Rossum
I'm confused. AFAICT enums are pickled by value too. What am I missing? Are we confused about terminology or about behavior? (I'm just guessing that the pickling happens by value because I don't see the string AF_INET.) $ python3 Python 3.4.0rc1+ (default:2ba583191550, Feb 11 2014, 16:05:24) [GCC

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Ethan Furman
On 02/18/2014 10:05 AM, Guido van Rossum wrote: Hm. But there's an implementation that has made it unscathed through several betas and an RC. AFAICT that beta pickles enums by value. And I happen to think that that is the better choice (but I don't have time to explain this gut feeling until af

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Serhiy Storchaka
18.02.14 19:11, Ethan Furman написав(ла): There is one more wrinkle to pickling by name (it's actually still there in pickle by value, just more obvious in pickle by name) -- aliases. It seems to me the most common scenario to having a name represent different values on different systems is when

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Guido van Rossum
Hm. But there's an implementation that has made it unscathed through several betas and an RC. AFAICT that beta pickles enums by value. And I happen to think that that is the better choice (but I don't have time to explain this gut feeling until after 3.4 has been released). On Tue, Feb 18, 2014 a

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Antoine Pitrou
On Tue, 18 Feb 2014 10:01:42 -0800 Ethan Furman wrote: > > I guess the question is which is more important? Identity comparison or this > (probably) rare use-case? If we stick > with identity I'm not aware of any work-around for pickling enum members that > are aliases on one system, but dis

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Ethan Furman
On 02/18/2014 09:47 AM, Guido van Rossum wrote: I'm confused. Hasn't this all been decided by the PEP long ago? The PEP only mentions pickling briefly, as in "the normal rules apply". How pickling occurs is an implementation detail, and it turns out that pickling by name is more robust. Se

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Guido van Rossum
I'm confused. Hasn't this all been decided by the PEP long ago? On Tue, Feb 18, 2014 at 9:11 AM, Ethan Furman wrote: > On 02/15/2014 11:01 AM, Serhiy Storchaka wrote: > >> How Enum items should be pickled, by value or by name? >> >> I think that Enum will be used to collect system-depending con

Re: [Python-Dev] Pickling of Enums

2014-02-18 Thread Ethan Furman
On 02/15/2014 11:01 AM, Serhiy Storchaka wrote: How Enum items should be pickled, by value or by name? I think that Enum will be used to collect system-depending constants, so the value of AddressFamily.AF_UNIX can be 1 on one platform and 2 on other. If pickle enums by value, then pickled Add

Re: [Python-Dev] Pickling of Enums

2014-02-15 Thread Antoine Pitrou
On Sat, 15 Feb 2014 21:01:36 +0200 Serhiy Storchaka wrote: > How Enum items should be pickled, by value or by name? > > I think that Enum will be used to collect system-depending constants, so > the value of AddressFamily.AF_UNIX can be 1 on one platform and 2 on > other. If pickle enums by val

[Python-Dev] Pickling of Enums

2014-02-15 Thread Serhiy Storchaka
How Enum items should be pickled, by value or by name? I think that Enum will be used to collect system-depending constants, so the value of AddressFamily.AF_UNIX can be 1 on one platform and 2 on other. If pickle enums by value, then pickled AddressFamily.AF_INET on on platform can be unpickl