Re: [Python-Dev] PEP 520: Ordered Class Definition Namespace

2016-06-14 Thread Nikita Nemkin
Is there any rationale for rejecting alternatives like: 1. Adding standard metaclass with ordered namespace. 2. Adding `namespace` or `ordered` args to the default metaclass. 3. Making compiler fill in __definition_order__ for every class (just like __qualname__) without touching the runtime.

Re: [Python-Dev] Current Python 3.2 status?

2016-06-14 Thread Georg Brandl
On 06/11/2016 07:41 PM, Chi Hsuan Yen wrote: > > > On Sun, Jun 12, 2016 at 1:02 AM, Berker Peksağ > wrote: > > On Sat, Jun 11, 2016 at 8:59 AM, Chi Hsuan Yen > wrote: > >

[Python-Dev] mod_python compilation error in VS 2008 for py2.7.1

2016-06-14 Thread asimkon
I would like to ask you a technical question regarding python module compilation for python 2.7.1. I want to compile mod_python library for Apache 2.2 and py2.7 on Win32 in order to use it for psp - py scripts that i

Re: [Python-Dev] [Python-checkins] cpython (3.5): Fix os.urandom() using getrandom() on Linux

2016-06-14 Thread Steven D'Aprano
Is this right? I thought we had decided that os.urandom should *not* fall back on getrandom on Linux? On Tue, Jun 14, 2016 at 02:36:27PM +, victor. stinner wrote: > https://hg.python.org/cpython/rev/e028e86a5b73 > changeset: 102033:e028e86a5b73 > branch: 3.5 > parent:

Re: [Python-Dev] PEP 468

2016-06-14 Thread Franklin? Lee
Compact OrderedDicts can leave gaps, and once in a while compactify. For example, whenever the entry table is full, it can decide whether to resize (and only copy non-gaps), or just compactactify Compact regular dicts can swap from the back and have no gaps. I don't see the point of discussing

Re: [Python-Dev] [Python-checkins] cpython (3.5): Fix os.urandom() using getrandom() on Linux

2016-06-14 Thread Jelle Zijlstra
I think this is an issue unrelated to the big discussion from a little while ago. The problem isn't that os.urandom() uses getrandom(), it's that it calls it in a mode that may block. 2016-06-14 8:07 GMT-07:00 Steven D'Aprano : > Is this right? I thought we had decided that

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Joao S. O. Bueno
On 14 June 2016 at 12:19, Steven D'Aprano wrote: > Is there > a good reason for returning bytes? What about: it returns 0-255 numeric values for each position in a stream, with no clue whatsoever to how those values map to text characters beyond the 32-128 range? Maybe

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Paul Moore
On 14 June 2016 at 16:19, Steven D'Aprano wrote: > Why does base64 encoding in Python return bytes? I seem to recall there was a debate about this around the time of the Python 3 move. (IIRC, it was related to the fact that there used to be a base64 "codec", that wasn't

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Victor Stinner
To port OpenStack to Python 3, I wrote 4 (2x2) helper functions which accept bytes *and* Unicode as input. xxx_as_bytes() functions return bytes, xxx_as_text() return Unicode: http://docs.openstack.org/developer/oslo.serialization/api.html Victor Le 14 juin 2016 5:21 PM, "Steven D'Aprano"

Re: [Python-Dev] [Python-checkins] cpython (3.5): Fix os.urandom() using getrandom() on Linux

2016-06-14 Thread Victor Stinner
Sorry, I don't hve the bandwith to follow the huge discussion around random in Python. If you want my help, please write a PEP to summarize the discussion. My change fixes an obvious bug. Even if the Python API changes, I don't expect that all the C code will be removed. Victor Le 14 juin 2016

Re: [Python-Dev] [Python-checkins] cpython (3.5): Fix os.urandom() using getrandom() on Linux

2016-06-14 Thread Victor Stinner
Le 14 juin 2016 5:28 PM, "Jelle Zijlstra" a écrit : >The problem isn't that os.urandom() uses getrandom(), it's that it calls it in a mode that may block. Except if it changed very recently, os.urandom() doesn't block anymore thanks to my previous change ;-) Victor

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Toshio Kuratomi
On Jun 14, 2016 8:32 AM, "Joao S. O. Bueno" wrote: > > On 14 June 2016 at 12:19, Steven D'Aprano wrote: > > Is there > > a good reason for returning bytes? > > What about: it returns 0-255 numeric values for each position in a stream, with > no clue

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Daniel Holth
IMO this is more a philosophical problem than a programming problem. base64 has a dual-nature. It is both text and bytes. At least it should fit in a 1-byte-per-character efficient Python 3 unicode string also. ___ Python-Dev mailing list

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Terry Reedy
On 6/14/2016 12:32 PM, Toshio Kuratomi wrote: The input to encoding would have to remain bytes (that's the main purpose of base64... to turn bytes into an ascii string). The purpose is to turn arbitrary binary data (commonly images) into 'safe bytes' that will not get mangled on transmission

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Terry Reedy
On 6/14/2016 11:19 AM, Steven D'Aprano wrote: Normally I'd take a question like this to Python-List, but this question has turned out to be quite diversive, with people having strong opinions but no definitive answer. So I thought I'd ask here and hope that some of the core devs would have an

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Joao S. O. Bueno
On 14 June 2016 at 14:45, Random832 wrote: > On Tue, Jun 14, 2016, at 13:05, Joao S. O. Bueno wrote: >> Sorry, it is 2016, and I don't think at this point anyone can consider >> an ASCII string >> as a representative pattern of textual data in any field of application. >>

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread R. David Murray
On Tue, 14 Jun 2016 14:05:19 -0300, "Joao S. O. Bueno" wrote: > On 14 June 2016 at 13:32, Toshio Kuratomi wrote: > > > > On Jun 14, 2016 8:32 AM, "Joao S. O. Bueno" wrote: > >> > >> On 14 June 2016 at 12:19, Steven D'Aprano

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Mark Lawrence via Python-Dev
On 14/06/2016 16:51, Paul Moore wrote: On 14 June 2016 at 16:19, Steven D'Aprano wrote: Why does base64 encoding in Python return bytes? I seem to recall there was a debate about this around the time of the Python 3 move. (IIRC, it was related to the fact that there used

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Joao S. O. Bueno
On 14 June 2016 at 13:32, Toshio Kuratomi wrote: > > On Jun 14, 2016 8:32 AM, "Joao S. O. Bueno" wrote: >> >> On 14 June 2016 at 12:19, Steven D'Aprano wrote: >> > Is there >> > a good reason for returning bytes? >> >> What about:

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Paul Sokolovsky
Hello, On Tue, 14 Jun 2016 16:51:44 +0100 Paul Moore wrote: > On 14 June 2016 at 16:19, Steven D'Aprano wrote: > > Why does base64 encoding in Python return bytes? > > I seem to recall there was a debate about this around the time of the > Python 3

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Random832
On Tue, Jun 14, 2016, at 13:05, Joao S. O. Bueno wrote: > Sorry, it is 2016, and I don't think at this point anyone can consider > an ASCII string > as a representative pattern of textual data in any field of application. > Bytes are not text. Bytes with an associated, meaningful, encoding are >

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Paul Sokolovsky
Hello, On Tue, 14 Jun 2016 14:02:02 -0400 Random832 wrote: > On Tue, Jun 14, 2016, at 13:19, Paul Sokolovsky wrote: > > Well, it's easy to remember the conclusion - it was decided to > > return bytes. The reason also wouldn't be hard to imagine - > > regardless of the

Re: [Python-Dev] mod_python compilation error in VS 2008 for py2.7.1

2016-06-14 Thread Terry Reedy
On 6/14/2016 4:44 AM, asimkon wrote: I would like to ask you a technical question regarding python module compilation for python 2.7.1. So you know, python-list, where you cross-posted this, is the right place for discussion of development *with* Python. python-dev is for development *of*

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Random832
On Tue, Jun 14, 2016, at 13:19, Paul Sokolovsky wrote: > Well, it's easy to remember the conclusion - it was decided to return > bytes. The reason also wouldn't be hard to imagine - regardless of the > fact that base64 uses ASCII codes for digits and letters, it's still > essentially a binary

[Python-Dev] ValuesView abc: why doesn't it (officially) inherit from Iterable?

2016-06-14 Thread Alan Franzoni
Hello, I hope not to bother anyone with a somewhat trivial question, I was unable to get an answer from other channels. I was just checking out some docs on ABCs for a project of mine, where I need to do some type-related work. Those are the official docs about the ValuesView type, in both Python

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Terry Reedy
On 6/14/2016 12:29 PM, Mark Lawrence via Python-Dev wrote: As I've the time to play detective I'd suggest https://mail.python.org/pipermail/python-3000/2007-July/008975.html Thank you for finding that. I reread it and still believe that bytes was the right choice. Base64 is an generic edge

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Paul Sokolovsky
Hello, On Tue, 14 Jun 2016 18:13:11 + Daniel Holth wrote: > IMO this is more a philosophical problem than a programming problem. > base64 has a dual-nature. It is both text and bytes. At least it > should fit in a 1-byte-per-character efficient Python 3 unicode > string

[Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Stephen J. Turnbull
Steven D'Aprano writes: > base64.b64encode take bytes as input and returns bytes. Some people are > arguing that this is wrong behaviour, as RFC 3548 That RFC is obsolete: the replacement is RFC 4648. However, the text is essentially unchanged. > specifies that Base64 should transform

Re: [Python-Dev] ValuesView abc: why doesn't it (officially) inherit from Iterable?

2016-06-14 Thread Brett Cannon
On Tue, 14 Jun 2016 at 13:30 Alan Franzoni wrote: > Hello, > I hope not to bother anyone with a somewhat trivial question, I was > unable to get an answer from other channels. > > I was just checking out some docs on ABCs for a project of mine, where > I need to do some

Re: [Python-Dev] ValuesView abc: why doesn't it (officially) inherit from Iterable?

2016-06-14 Thread Alan Franzoni
ValuesView doesn't inherit from Set because the values in a dictionary can contain duplicates. That makes sense. It's just the missing Iterable, which is a weaker contract, that doesn't. I'm filing the bug tomorrow. On Tue, Jun 14, 2016 at 10:44 PM, Brett Cannon wrote: > On

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Steven D'Aprano
On Tue, Jun 14, 2016 at 05:29:12PM +0100, Mark Lawrence via Python-Dev wrote: > As I've the time to play detective I'd suggest > https://mail.python.org/pipermail/python-3000/2007-July/008975.html Thanks Mark, that's great! -- Steve ___ Python-Dev

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Stephen J. Turnbull
Greg Ewing writes: > The RFC does *not* do that. It describes the output in terms of > characters, and does not specify any bit patterns for the > output. The RFC is unclear on this point, but I read it as specifying the ASCII coded character set, not the ASCII repertoire of (abstract)

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Random832
On Tue, Jun 14, 2016, at 22:58, Stephen J. Turnbull wrote: > The RFC is unclear on this point, but I read it as specifying the > ASCII coded character set, not the ASCII repertoire of (abstract) > characters. Therefore, it specifies an invertible mapping from a > particular set of integers to

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Greg Ewing
Stephen J. Turnbull wrote: it does refer to *encoded* characters as the output of the encoding process: > The encoding process represents 24-bit groups of input bits > as output strings of 4 encoded characters. The "encoding" being referred to there is the encoding from input bytes

Re: [Python-Dev] [Python-checkins] cpython (3.5): Fix os.urandom() using getrandom() on Linux

2016-06-14 Thread Larry Hastings
On 06/14/2016 08:07 AM, Steven D'Aprano wrote: Is this right? I thought we had decided that os.urandom should *not* fall back on getrandom on Linux? We decided that os.urandom() should not *block* on Linux. Which it doesn't; we now strictly call getrandom(GRND_NONBLOCK), which will never

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Greg Ewing
R. David Murray wrote: The fundamental purpose of the base64 encoding is to take a series of arbitrary bytes and reversibly turn them into another series of bytes in which the eighth bit is not significant. No, it's not. If that were its only purpose, it would be called base128, and the RFC

Re: [Python-Dev] Why does base64 return bytes?

2016-06-14 Thread Greg Ewing
Joao S. O. Bueno wrote: The arguments about compactness and what is most likely to happen next applies (transmission trhough a binary network protocol), I'm not convinced that this is what is most likely to happen next *in a Python program*. How many people implement their own binary network