Re: [Python-ideas] incremental hashing in __hash__

2017-01-06 Thread Neil Girdhar
On Fri, Jan 6, 2017 at 2:07 AM Stephen J. Turnbull < [email protected]> wrote: > Neil Girdhar writes: > > > I don't understand this? How is providing a default method in an > > abstract base class a pessimization? If it happens to be slower > > than the code in the current m

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread INADA Naoki
LGTM. Some comments: I want UTF-8 mode is enabled by default (opt-out option) even if locale is not POSIX, like `PYTHONLEGACYWINDOWSFSENCODING`. Users depends on locale know what locale is and how to configure it. They can understand difference between locale mode and UTF-8 mode and they can opt

Re: [Python-ideas] incremental hashing in __hash__

2017-01-06 Thread Paul Moore
On 6 January 2017 at 09:02, Neil Girdhar wrote: > > Yeah, looks like you missed a revision. There were two emails. I suggested > adding ImmutableIterable and ImmutableSet, and so there is an obvious > implementation of __hash__ for both. OK, sorry. The proposal is still getting more complicate

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Stephan Houben
Hi all, One meta-question I have which may already have been discussed much earlier in this whole proposal series, is: How common is this problem? Because I have the impression that nowadays all Linux distributions are UTF-8 by default and you have to show some bloody-mindedness to end up with a

Re: [Python-ideas] incremental hashing in __hash__

2017-01-06 Thread Stephen J. Turnbull
Neil Girdhar writes: > I don't understand this? How is providing a default method in an > abstract base class a pessimization? If it happens to be slower > than the code in the current methods, it can still be overridden. How often will people override until it's bitten them? How many peopl

Re: [Python-ideas] incremental hashing in __hash__

2017-01-06 Thread Paul Moore
On 6 January 2017 at 07:26, Neil Girdhar wrote: > On Fri, Jan 6, 2017 at 2:07 AM Stephen J. Turnbull > wrote: >> >> Neil Girdhar writes: >> >> > I don't understand this? How is providing a default method in an >> > abstract base class a pessimization? If it happens to be slower >> > than the

Re: [Python-ideas] incremental hashing in __hash__

2017-01-06 Thread Neil Girdhar
On Fri, Jan 6, 2017 at 3:59 AM Paul Moore wrote: > On 6 January 2017 at 07:26, Neil Girdhar wrote: > > On Fri, Jan 6, 2017 at 2:07 AM Stephen J. Turnbull > > wrote: > >> > >> Neil Girdhar writes: > >> > >> > I don't understand this? How is providing a default method in an > >> > abstract bas

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread M.-A. Lemburg
On 06.01.2017 04:32, Nick Coghlan wrote: > On 6 January 2017 at 12:37, Victor Stinner wrote: >> 2017-01-06 3:10 GMT+01:00 Stephen J. Turnbull >> : >>> I've quoted Victor out of context, and his other posts make me very >>> doubtful that he considers this a serious alternative. That said, I'm >>>

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Victor Stinner
2017-01-06 8:21 GMT+01:00 INADA Naoki : > I want UTF-8 mode is enabled by default (opt-out option) even if > locale is not POSIX, > like `PYTHONLEGACYWINDOWSFSENCODING`. You do, I don't :-) It shouldn't be hard to find very concrete issues from the mojibake issues described at: https://www.python

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Victor Stinner
2017-01-06 7:22 GMT+01:00 Stephan Houben : > How common is this problem? Last 2 or 3 years, I don't recall having be bitten by such issue. On the bug tracker, new issues are opened infrequently. * http://bugs.python.org/issue19977 opened at 2013-12-13, closed at 2014-04-27 * http://bugs.python.o

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Victor Stinner
2017-01-06 10:50 GMT+01:00 M.-A. Lemburg : > Victor: I think you are taking the UTF-8 idea a bit too far. Hum, sorry, the PEP is still a draft, the rationale is far from perfect yet. Let me try to simplify the issue: users are unable to configure a locale for various reasons and expect that Python

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Stephan Houben
Hi Victor, 2017-01-06 13:01 GMT+01:00 Victor Stinner : > > What do you mean by "eating mojibake"? OK, I erroneously understood that the failure mode was that mojibake was produced. > Users complain because their > application is stopped by a Python exception. Got it. > Currently, most Python 3

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Oleg Broytman
On Fri, Jan 06, 2017 at 10:15:52AM +0900, INADA Naoki wrote: > >> Always use UTF-8 > >> > >> > >> Python already always use the UTF-8 encoding on Mac OS X, Android and > >> Windows. > >> Since UTF-8 became the defacto encoding, it makes sense to always use it > >> on all > >> p

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Barry Warsaw
On Jan 06, 2017, at 07:22 AM, Stephan Houben wrote: >Because I have the impression that nowadays all Linux distributions are UTF-8 >by default and you have to show some bloody-mindedness to end up with a POSIX >locale. It can still happen in some corner cases, even on Debian and Ubuntu where C.UT

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Barry Warsaw
On Jan 05, 2017, at 05:50 PM, Victor Stinner wrote: >I guess that all users and most developers are more in the "UNIX mode" >camp. *If* we want to change the default, I suggest to use the "UNIX >mode" by default. FWIW, it seems to be a general and widespread recommendation to always pass universa

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Chris Angelico
On Sat, Jan 7, 2017 at 8:20 AM, Barry Warsaw wrote: > On Jan 06, 2017, at 07:22 AM, Stephan Houben wrote: > >>Because I have the impression that nowadays all Linux distributions are UTF-8 >>by default and you have to show some bloody-mindedness to end up with a POSIX >>locale. > > It can still hap

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Victor Stinner
2017-01-06 22:20 GMT+01:00 Barry Warsaw : >>Because I have the impression that nowadays all Linux distributions are UTF-8 >>by default and you have to show some bloody-mindedness to end up with a POSIX >>locale. > > It can still happen in some corner cases, even on Debian and Ubuntu where > C.UTF-8

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Barry Warsaw
On Jan 06, 2017, at 11:33 PM, Victor Stinner wrote: >Barry: About chroot, why do you get a C locale? Is it because no >locale is explicitly configured? Or because no locale is installed in >the chroot? For some reason it's not configured: % schroot -u root -c sid-amd64 (sid-amd64)# locale LANG=

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Victor Stinner
2017-01-07 1:06 GMT+01:00 Barry Warsaw : > For some reason it's not configured: (...) Ok, thanks for the information. > I'm not sure why that's the default inside a chroot. I found at least one good reason to use the POSIX locale to build a package: it helps to get reproductible builds, see: htt

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-06 Thread Steve Dower
Passing universal_newlines will use whatever locale.getdefaultencoding() returns (which at least on Windows is useless enough that I added the encoding and errors parameters in 3.6). So it sounds like it'll only actually do Unicode on Linux if enough of the planets have aligned, which is what Vi