Re: [Python-Dev] Backporting PEP 414

2012-02-29 Thread Baptiste Carvello
Le 29/02/2012 00:25, Nick Coghlan a écrit : Also, I think there may be some confusion about Armin's plan to handle 3.2 - he aims to write an *import hook* that accepts the u/U prefixes during tokenisation, not a source-to-source transform like 2to3. this needs to be emphasized. Read from

Re: [Python-Dev] Spreading the Python 3 religion (was Re: PEP 414 - Unicode Literals for Python 3)

2012-02-29 Thread Jesse Noller
FWIW, I agree that much of the rhetoric in the current version of PEP 414 is excessive. Armin has given me permission to create an updated version of PEP 414 and toning down the hyperbole (or removing it entirely in cases where it's irrelevant to the final decision) is one of the things

Re: [Python-Dev] PEP 414

2012-02-29 Thread Yury Selivanov
Armin, I see you've (or somebody) changed: As it stands, Python 3 is currently a bad choice for long-term investments, since the ecosystem is not yet properly developed, and libraries are still fighting with their API decisions for Python 3. to: As it stands, when chosing between 2.7 and

Re: [Python-Dev] PEP 414

2012-02-29 Thread Yury Selivanov
Armin, I see you've (or somebody) changed: As it stands, Python 3 is currently a bad choice for long-term investments, since the ecosystem is not yet properly developed, and libraries are still fighting with their API decisions for Python 3. to: As it stands, when chosing between 2.7 and

Re: [Python-Dev] PEP 414

2012-02-29 Thread Barry Warsaw
On Feb 29, 2012, at 07:30 AM, Yury Selivanov wrote: As it stands, Python 3 is currently a bad choice for long-term investments, since the ecosystem is not yet properly developed, and libraries are still fighting with their API decisions for Python 3. to: As it stands, when chosing between 2.7

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

2012-02-29 Thread Victor Stinner
As requested, I create a PEP and a related issue: http://www.python.org/dev/peps/pep-0416/ http://bugs.python.org/issue14162 The PEP 416 is different from my previous propositions: frozendict values can be mutable and dict doesn't inherit from frozendict anymore. But it is still possible to use

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

2012-02-29 Thread David Malcolm
On Wed, 2012-02-29 at 19:21 +0100, Victor Stinner wrote: As requested, I create a PEP and a related issue: http://www.python.org/dev/peps/pep-0416/ [...snip...] Rationale = A frozendict mapping cannot be changed, but its values can be mutable (not hashable). A frozendict is

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

2012-02-29 Thread Eli Bendersky
Rationale = A frozendict mapping cannot be changed, but its values can be mutable (not hashable). A frozendict is hashable and so immutable if all values are hashable (immutable). The wording of the above seems very unclear to me. Do you mean A frozendict has a constant set

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

2012-02-29 Thread Raymond Hettinger
On Feb 27, 2012, at 10:53 AM, Victor Stinner wrote: A frozendict type is a common request from users and there are various implementations. ISTM, this request is never from someone who has a use case. Instead, it almost always comes from completers, people who see that we have a frozenset

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

2012-02-29 Thread Eli Bendersky
The frozenset type covers a niche case that is nice-to-have but *rarely* used. Many experienced Python users simply forget that we have a frozenset type. We don't get bug reports or feature requests about the type. When I do Python consulting work, I never see it in a client's codebase.

Re: [Python-Dev] State of PEP-3118 (memoryview part)

2012-02-29 Thread Stefan Krah
Antoine Pitrou solip...@pitrou.net wrote: Stefan Krah ste...@bytereef.org wrote: In Python 3.3 most issues with the memoryview object have been fixed in a recent commit (3f9b3b6f7ff0). Oh and congrats for doing this, of course. Thanks! Stefan Krah

Re: [Python-Dev] State of PEP-3118 (memoryview part)

2012-02-29 Thread Stefan Krah
Greg Ewing greg.ew...@canterbury.ac.nz wrote: Options 2) and 3) would ideally entail one backwards incompatible bugfix: In 2.7 and 3.2 assignment to a memoryview with format 'B' rejects integers but accepts byte objects, but according to the struct syntax mandated by the PEP it should be the

Re: [Python-Dev] PEP 411: Provisional packages in the Python standard library

2012-02-29 Thread Eli Bendersky
I have updated PEP 411, following the input from this discussion. The updated PEP is at: http://hg.python.org/peps/file/default/pep-0411.txt Changes: - Specified that a package may remain provisional for longer than a single minor release - Shortened the suggested documentation notice, linking

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

2012-02-29 Thread Paul Moore
On 29 February 2012 19:17, Raymond Hettinger raymond.hettin...@gmail.com wrote: From this experience, I conclude that adding a frozendict type would be a total waste (except that it would inspire more people to request frozen variante of other containers). It would (apparently) help Victor to

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

2012-02-29 Thread Nick Coghlan
On Thu, Mar 1, 2012 at 7:08 AM, Paul Moore p.f.mo...@gmail.com wrote: As it stands, I don't find the PEP compelling. The hardening use case might be significant but Victor needs to spell it out if it's to make a difference. +1 Avoiding-usenet-nod-syndrome'ly, Nick. -- Nick Coghlan   |  

Re: [Python-Dev] Backporting PEP 414

2012-02-29 Thread Calvin Spealman
On Feb 28, 2012 7:14 PM, mar...@v.loewis.de wrote: Why is readding u'' a feature and not a bug? There is a really simple litmus test for whether something is a bug: does it deviate from the specification? In this case, the specification is the grammar, and the implementation certainly

Re: [Python-Dev] Backporting PEP 414

2012-02-29 Thread R. David Murray
On Wed, 29 Feb 2012 17:06:21 -0500, Calvin Spealman ironfro...@gmail.com wrote: On Feb 28, 2012 7:14 PM, mar...@v.loewis.de wrote: Why is readding u'' a feature and not a bug? There is a really simple litmus test for whether something is a bug: does it deviate from the specification?

Re: [Python-Dev] Backporting PEP 414

2012-02-29 Thread Martin v. Löwis
There is a really simple litmus test for whether something is a bug: does it deviate from the specification? In this case, the specification is the grammar, and the implementation certainly doesn't deviate from it. So it can't be a bug. I don't think anyone can assert that the

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

2012-02-29 Thread Chris Angelico
On Thu, Mar 1, 2012 at 8:08 AM, Paul Moore p.f.mo...@gmail.com wrote: It would (apparently) help Victor to fix issues in his pysandbox project. I don't know if a secure Python sandbox is an important enough concept to warrant core changes to make it possible. If a secure Python sandbox had

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

2012-02-29 Thread Raymond Hettinger
On Feb 29, 2012, at 1:08 PM, Paul Moore wrote: As it stands, I don't find the PEP compelling. The hardening use case might be significant but Victor needs to spell it out if it's to make a difference. If his sandboxing project needs it, the type need not be public. It can join dictproxy and

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

2012-02-29 Thread Victor Stinner
It would (apparently) help Victor to fix issues in his pysandbox project. I don't know if a secure Python sandbox is an important enough concept to warrant core changes to make it possible. Ok, let's talk about sandboxing and security. The main idea of pysandbox is to reuse most of CPython

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

2012-02-29 Thread R. David Murray
On Thu, 01 Mar 2012 10:13:01 +1100, Chris Angelico ros...@gmail.com wrote: On Thu, Mar 1, 2012 at 8:08 AM, Paul Moore p.f.mo...@gmail.com wrote: It would (apparently) help Victor to fix issues in his pysandbox project. I don't know if a secure Python sandbox is an important enough concept

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

2012-02-29 Thread Raymond Hettinger
On Feb 29, 2012, at 3:52 PM, Victor Stinner wrote: I don't know if hardening Python is a compelling argument to add a new builtin type. It isn't. Builtins are for general purpose use. It is not something most people should use; however, if it is a builtin, people will be drawn to

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

2012-02-29 Thread Victor Stinner
A frozendict type is a common request from users and there are various implementations. ISTM, this request is never from someone who has a use case. One of my colleagues implemented recently its own frozendict class (which the frozendict name ;-)). He tries to implement something like the PEP

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

2012-02-29 Thread Steven D'Aprano
Raymond Hettinger wrote: On Feb 29, 2012, at 3:52 PM, Victor Stinner wrote: I don't know if hardening Python is a compelling argument to add a new builtin type. It isn't. Builtins are for general purpose use. It is not something most people should use; however, if it is a builtin, people

Re: [Python-Dev] State of PEP-3118 (memoryview part)

2012-02-29 Thread Terry Reedy
On 2/29/2012 2:34 PM, Stefan Krah wrote: Greg Ewinggreg.ew...@canterbury.ac.nz wrote: Options 2) and 3) would ideally entail one backwards incompatible bugfix: In 2.7 and 3.2 assignment to a memoryview with format 'B' rejects integers but accepts byte objects, but according to the struct

Re: [Python-Dev] Backporting PEP 414

2012-02-29 Thread Terry Reedy
Armin filed and argued for the addition in a PEP, a Python *Enhancement* Proposal. He did not file a bugfix behavior issue on the tracker. Let us leave it as that. x.y is a specified language. We continuously improve the x.y docs that describe and explain the specification. We also improve

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

2012-02-29 Thread Steven D'Aprano
Raymond Hettinger wrote: On Feb 27, 2012, at 10:53 AM, Victor Stinner wrote: A frozendict type is a common request from users and there are various implementations. ISTM, this request is never from someone who has a use case. Instead, it almost always comes from completers, people who see

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

2012-02-29 Thread Raymond Hettinger
On Feb 29, 2012, at 4:23 PM, Victor Stinner wrote: One of my colleagues implemented recently its own frozendict class (which the frozendict name ;-) I write new collection classes all the time. That doesn't mean they warrant inclusion in the library or builtins. There is a use case for

Re: [Python-Dev] State of PEP-3118 (memoryview part)

2012-02-29 Thread Terry Reedy
[erroneouly hit send button before instead of edit menu above it] On 2/29/2012 2:34 PM, Stefan Krah wrote: Greg Ewinggreg.ew...@canterbury.ac.nz wrote: Options 2) and 3) would ideally entail one backwards incompatible bugfix: In 2.7 and 3.2 assignment to a memoryview with format 'B' rejects

Re: [Python-Dev] State of PEP-3118 (memoryview part)

2012-02-29 Thread Nick Coghlan
On Thu, Mar 1, 2012 at 11:48 AM, Terry Reedy tjre...@udel.edu wrote: * As for porting, my impression is that the PEP directly affects only C code and Python code using ctypes and only some fraction of those. If the bugfix-only patch is significantly different from complete patch, porting to

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

2012-02-29 Thread Guido van Rossum
On Wed, Feb 29, 2012 at 3:52 PM, Victor Stinner victor.stin...@haypocalc.com wrote: It would (apparently) help Victor to fix issues in his pysandbox project. I don't know if a secure Python sandbox is an important enough concept to warrant core changes to make it possible. Ok, let's talk

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

2012-02-29 Thread Jim J. Jewett
In http://mail.python.org/pipermail/python-dev/2012-February/117113.html Victor Stinner posted: An immutable mapping can be implemented using frozendict:: class immutabledict(frozendict): def __new__(cls, *args, **kw): # ensure that all values are immutable

Re: [Python-Dev] PEP czar for PEP 3144?

2012-02-29 Thread Peter Moody
Just checking in: On Mon, Feb 20, 2012 at 5:48 PM, Nick Coghlan ncogh...@gmail.com wrote: At the very least: - the IP Interface API needs to move to a point where it more clearly *is* an IP Address and *has* an associated IP Network (rather than being the other way around) This is done [1].

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

2012-02-29 Thread Georg Brandl
On 01.03.2012 02:45, Raymond Hettinger wrote: On Feb 29, 2012, at 4:23 PM, Victor Stinner wrote: One of my colleagues implemented recently its own frozendict class (which the frozendict name ;-) I write new collection classes all the time. That doesn't mean they warrant inclusion in the

Re: [Python-Dev] PEP czar for PEP 3144?

2012-02-29 Thread Nick Coghlan
On Thu, Mar 1, 2012 at 3:13 PM, Peter Moody pmo...@google.com wrote: Just checking in: On Mon, Feb 20, 2012 at 5:48 PM, Nick Coghlan ncogh...@gmail.com wrote: At the very least: - the IP Interface API needs to move to a point where it more clearly *is* an IP Address and *has* an associated

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

2012-02-29 Thread Serhiy Storchaka
01.03.12 01:52, Victor Stinner написав(ла): Problem: if you implement a frozendict type inheriting from dict in Python, it is still possible to call dict methods (e.g. dict.__setitem__()). To fix this issue, pysandbox removes all dict methods modifying the dict: __setitem__, __delitem__, pop,