[Python-Dev] PEP 414 updated

2012-03-03 Thread Nick Coghlan
My rewritten version of PEP 414 is now up (http://www.python.org/dev/peps/pep-0414/). It describes in detail a lot more of the historical background that was taken as read when Guido accepted the PEP. Can we let the interminable discussion die now? Please? Regards, Nick. P.S. If you find an act

Re: [Python-Dev] PEP 414

2012-03-03 Thread Serhiy Storchaka
04.03.12 00:12, "Martin v. Löwis" написав(ла): 2to3 should recognize the str(string_literal) (or nstr(), or native(), etc) ​​as a native string and does not add prefix "u" to it. And you have to explicitly specify these tips. That is already implemented. 2to3 *never* adds a u prefix anywhere, i

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Nick Coghlan
On Sun, Mar 4, 2012 at 12:24 PM, Thomas Wouters wrote: > (Let's not forget about tp_as_sequence.sq_concat, tp_as_number.nb_add, > tp_as_sequence.sq_repeat and tp_as_number.nb_mul either.) Indeed, let's not forget about those, which are a compatibility problem in and of themselves: http://bugs.pyt

Re: [Python-Dev] Sandboxing Python

2012-03-03 Thread Maciej Fijalkowski
On Sat, Mar 3, 2012 at 6:51 PM, Guido van Rossum wrote: > On Sat, Mar 3, 2012 at 6:02 PM, Maciej Fijalkowski wrote: >> On Sat, Mar 3, 2012 at 1:37 PM, Victor Stinner >> wrote: >>> Hi, >>> >>> Le 03/03/2012 20:13, Armin Rigo a écrit : >>> >> I challenge anymore to break pysandbox! I would be

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Eli Bendersky
>> Thomas Wouters, 03.03.2012 21:59: >> > Why even have separate tp_as_sequence and tp_as_mapping anymore? That >> > particular distinction never existed for Python types, so why should it >> > exist for C types at all? I forget if there was ever a real point to it, >> > but all it seems to do now

Re: [Python-Dev] Sandboxing Python

2012-03-03 Thread Guido van Rossum
On Sat, Mar 3, 2012 at 6:02 PM, Maciej Fijalkowski wrote: > On Sat, Mar 3, 2012 at 1:37 PM, Victor Stinner > wrote: >> Hi, >> >> Le 03/03/2012 20:13, Armin Rigo a écrit : >> > I challenge anymore to break pysandbox! I would be happy if anyone > breaks it because it would make it more str

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Thomas Wouters
On Sat, Mar 3, 2012 at 13:12, Stefan Behnel wrote: > Thomas Wouters, 03.03.2012 21:59: > > Why even have separate tp_as_sequence and tp_as_mapping anymore? That > > particular distinction never existed for Python types, so why should it > > exist for C types at all? I forget if there was ever a r

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Thomas Wouters
On Sat, Mar 3, 2012 at 13:02, Antoine Pitrou wrote: > On Sat, 3 Mar 2012 12:59:13 -0800 > Thomas Wouters wrote: > > > > Why even have separate tp_as_sequence and tp_as_mapping anymore? That > > particular distinction never existed for Python types, so why should it > > exist for C types at all?

Re: [Python-Dev] PEP 416: Add a frozendict builtin type

2012-03-03 Thread Eric Snow
On Sat, Mar 3, 2012 at 4:11 PM, Victor Stinner wrote: > Le 29/02/2012 19:21, Victor Stinner a écrit : >> >> Rationale >> = >> >> (...) Use cases of frozendict: (...) > > > I updated the PEP to list use cases described in the other related mailing > list thread. > --- > Use cases: > >  * fr

Re: [Python-Dev] Sandboxing Python

2012-03-03 Thread Maciej Fijalkowski
On Sat, Mar 3, 2012 at 1:37 PM, Victor Stinner wrote: > Hi, > > Le 03/03/2012 20:13, Armin Rigo a écrit : > I challenge anymore to break pysandbox! I would be happy if anyone breaks it because it would make it more stronger. >> >> >> I tried to run the files from Lib/test/crashers and --

Re: [Python-Dev] Why does Mac OS X python share site-packages with apple python?

2012-03-03 Thread Barry Scott
On 3 Mar 2012, at 21:57, Ned Deily wrote: > In article <5a0e2490-a743-4729-a752-d94524ea9...@barrys-emacs.org>, > Barry Scott wrote: >> On my Mac OS X 10.7.3 System I have lots of python kits installed for >> developing extensions. >> >> I'll just noticed that Python.org 2.7.2 uses the sames s

Re: [Python-Dev] cpython compilation error

2012-03-03 Thread Amaury Forgeot d'Arc
2012/3/3 Vinay Sajip > Ejaj Hassan gmail.com> writes: > > > I was compiling Pcbuild.sln from cpython in vc++ 2008 and i got > the > error as "Solution folders are not supported in this version of > application-Solution folder will be displayed as unavailable". > > Could someone please

Re: [Python-Dev] PEP 416: Add a frozendict builtin type

2012-03-03 Thread Victor Stinner
Le 29/02/2012 19:21, Victor Stinner a écrit : Rationale = (...) Use cases of frozendict: (...) I updated the PEP to list use cases described in the other related mailing list thread. --- Use cases: * frozendict lookup can be done at compile time instead of runtime because the mapp

Re: [Python-Dev] PEP 414

2012-03-03 Thread Martin v. Löwis
> 2to3 should recognize the str(string_literal) (or nstr(), or native(), > etc) ​​as a native string and does not add prefix "u" to it. And you > have to explicitly specify these tips. That is already implemented. 2to3 *never* adds a u prefix anywhere, including not for str(string_literal). Regar

Re: [Python-Dev] Why does Mac OS X python share site-packages with apple python?

2012-03-03 Thread Ned Deily
In article <5a0e2490-a743-4729-a752-d94524ea9...@barrys-emacs.org>, Barry Scott wrote: > On my Mac OS X 10.7.3 System I have lots of python kits installed for > developing extensions. > > I'll just noticed that Python.org 2.7.2 uses the sames site-packages folder > with Apple's > 2.7.1. > > S

Re: [Python-Dev] Sandboxing Python

2012-03-03 Thread Victor Stinner
Hi, Le 03/03/2012 20:13, Armin Rigo a écrit : I challenge anymore to break pysandbox! I would be happy if anyone breaks it because it would make it more stronger. I tried to run the files from Lib/test/crashers and --- kind of obviously --- I found at least two of them that still segfaults exe

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Stefan Behnel
Thomas Wouters, 03.03.2012 21:59: > Why even have separate tp_as_sequence and tp_as_mapping anymore? That > particular distinction never existed for Python types, so why should it > exist for C types at all? I forget if there was ever a real point to it, > but all it seems to do now is create confu

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Antoine Pitrou
On Sat, 3 Mar 2012 12:59:13 -0800 Thomas Wouters wrote: > > Why even have separate tp_as_sequence and tp_as_mapping anymore? That > particular distinction never existed for Python types, so why should it > exist for C types at all? I forget if there was ever a real point to it, > but all it seems

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Thomas Wouters
On Sat, Mar 3, 2012 at 10:18, Eli Bendersky wrote: > On Sat, Mar 3, 2012 at 19:58, Guido van Rossum wrote: > > On Sat, Mar 3, 2012 at 4:20 AM, Antoine Pitrou > wrote: > >>> I'd expect slice subscripts to be part of the sequence interface, and > >>> yet they are not. In fact, they are part of th

Re: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()

2012-03-03 Thread Thomas Wouters
On Sat, Mar 3, 2012 at 03:08, Stefan Krah wrote: > Stefan Behnel wrote: > > > 1. assert() is the wrong tool for this job > > > > Absolutely. > > I disagree. This assert() is meant for extension authors and not end > users. I > can't see how a reasonable release procedure would fail to trigger th

Re: [Python-Dev] Sandboxing Python

2012-03-03 Thread Armin Rigo
Hi Victor, On Thu, Mar 1, 2012 at 22:59, Victor Stinner wrote: >> I challenge anymore to break pysandbox! I would be happy if anyone >> breaks it because it would make it more stronger. I tried to run the files from Lib/test/crashers and --- kind of obviously --- I found at least two of them tha

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Eli Bendersky
On Sat, Mar 3, 2012 at 19:58, Guido van Rossum wrote: > On Sat, Mar 3, 2012 at 4:20 AM, Antoine Pitrou wrote: >>> I'd expect slice subscripts to be part of the sequence interface, and >>> yet they are not. In fact, they are part of the mapping interface. For >>> example, the list object has its s

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Guido van Rossum
On Sat, Mar 3, 2012 at 4:20 AM, Antoine Pitrou wrote: >> I'd expect slice subscripts to be part of the sequence interface, and >> yet they are not. In fact, they are part of the mapping interface. For >> example, the list object has its slice get/set methods assigned to a >> PyMappingMethods struc

Re: [Python-Dev] cpython compilation error

2012-03-03 Thread Vinay Sajip
Ejaj Hassan gmail.com> writes: >         I was compiling  Pcbuild.sln from cpython in vc++ 2008 and i got the error as "Solution folders are not supported in this version of application-Solution folder will be displayed as unavailable".  >  Could someone please tell me the source and reason for t

[Python-Dev] Why does Mac OS X python share site-packages with apple python?

2012-03-03 Thread Barry Scott
On my Mac OS X 10.7.3 System I have lots of python kits installed for developing extensions. I'll just noticed that Python.org 2.7.2 uses the sames site-packages folder with Apple's 2.7.1. Since extensions compiled against Apple's 2.7.1 segv when used by python.org's 2.7.2 this is at least unf

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Antoine Pitrou
Le samedi 03 mars 2012 à 14:41 +0200, Eli Bendersky a écrit : > >> I'd expect slice subscripts to be part of the sequence interface, and > >> yet they are not. In fact, they are part of the mapping interface. For > >> example, the list object has its slice get/set methods assigned to a > >> PyMappi

Re: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()

2012-03-03 Thread Stefan Krah
Nick Coghlan wrote: > 2. the current check is too strict (it should just check for obj != > NULL, not obj == &exporter) Yes. For anyone who is interested, see issue #14181. > 3. the current check is in the wrong place (it should be in > PyObject_GetBuffer) Agreed, since it's not memoryview sp

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Eli Bendersky
>> I'd expect slice subscripts to be part of the sequence interface, and >> yet they are not. In fact, they are part of the mapping interface. For >> example, the list object has its slice get/set methods assigned to a >> PyMappingMethods struct. So does a bytes object, and pretty much every >> oth

Re: [Python-Dev] PEP 414

2012-03-03 Thread Lennart Regebro
On Sat, Mar 3, 2012 at 11:39, Vinay Sajip wrote: > Sorry, I didn't make myself clear. If you import unicode_literals, then in > both > 2.x and 3.x code, an unadorned literal string is text, and a b-adorned literal > string is bytes. My assertion was based on that assumption - the text > (Unicode

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Antoine Pitrou
Hi, > I'd expect slice subscripts to be part of the sequence interface, and > yet they are not. In fact, they are part of the mapping interface. For > example, the list object has its slice get/set methods assigned to a > PyMappingMethods struct. So does a bytes object, and pretty much every > ot

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Eli Bendersky
On Sat, Mar 3, 2012 at 11:24, Stefan Behnel wrote: > Eli Bendersky, 03.03.2012 09:36: >> I find a strange discrepancy in Python with regards to slice >> subscripting of objects, at the C API level. I mean things like >> obj[start:end:step]. >> >> I'd expect slice subscripts to be part of the seque

Re: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()

2012-03-03 Thread Stefan Krah
Stefan Behnel wrote: > > 1. assert() is the wrong tool for this job > > Absolutely. I disagree. This assert() is meant for extension authors and not end users. I can't see how a reasonable release procedure would fail to trigger the assert(). My procedure as a C extension author is to test agai

Re: [Python-Dev] PEP 414

2012-03-03 Thread Vinay Sajip
Lennart Regebro gmail.com> writes: > I'm not sure that's true at all. In most cases where you support both > Python 2 and Python 3, most strings will be "native", ie, without > prefix in either Python 2 or Python 3. The native case is the most > common case. Sorry, I didn't make myself clear. If

Re: [Python-Dev] PEP 414

2012-03-03 Thread Lennart Regebro
On Sat, Mar 3, 2012 at 10:26, Vinay Sajip wrote: > Lennart Regebro gmail.com> writes: > >> So the question is if you have any proposal that is *less* confusing >> while still being practical. Because we do need to distinguish between >> binary, Unicode and "native" strings. Isn't this the least c

Re: [Python-Dev] PEP 414

2012-03-03 Thread Vinay Sajip
Lennart Regebro gmail.com> writes: > So the question is if you have any proposal that is *less* confusing > while still being practical. Because we do need to distinguish between > binary, Unicode and "native" strings. Isn't this the least confusing > solution? It's a matter of the degree of con

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Stefan Behnel
Eli Bendersky, 03.03.2012 09:36: > I find a strange discrepancy in Python with regards to slice > subscripting of objects, at the C API level. I mean things like > obj[start:end:step]. > > I'd expect slice subscripts to be part of the sequence interface, and > yet they are not. In fact, they are p

Re: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()

2012-03-03 Thread Stefan Behnel
Nick Coghlan, 03.03.2012 00:49: > On Sat, Mar 3, 2012 at 3:14 AM, Stefan Behnel wrote: >> Stefan Krah, 02.03.2012 17:42: >>> The reason why this scheme was not chosen for a chain of memoryviews >>> was that 'exporter' (in theory) could implement a slideshow of buffers, >>> which means that in the f

Re: [Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Eli Bendersky
> This doesn't align well with the documentation, in at least two places. > Another place is in http://docs.python.org/dev/reference/datamodel.html: " object.__getitem__(self, key) Called to implement evaluation of self[key]. For sequence types, the accepted keys should be integers and slic

Re: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()

2012-03-03 Thread Stefan Krah
Stefan Behnel wrote: > Yes, that's a suitable example. It would take the ndarray out of the loop - > after all, it has nothing to do with what the memoryview wants, and won't > need to do any cleanup for the memoryview's buffer view either. Keeping it > explicitly alive in the memoryview is just a

[Python-Dev] slice subscripts for sequences and mappings

2012-03-03 Thread Eli Bendersky
Hello, I find a strange discrepancy in Python with regards to slice subscripting of objects, at the C API level. I mean things like obj[start:end:step]. I'd expect slice subscripts to be part of the sequence interface, and yet they are not. In fact, they are part of the mapping interface. For exa