Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Paul Moore
On 11 August 2016 at 00:30, Random832 wrote: >> Python could copy how >> configure_text_mode() handles the BOM, except it shouldn't write a BOM >> for new UTF-8 files. > > I disagree. I think that *on windows* it should, just like *on windows* > it should write CR-LF for line endings. Tools like

Re: [Python-ideas] PEP 525: Asynchronous Generators

2016-08-11 Thread Cory Benfield
> On 11 Aug 2016, at 04:46, Chris Angelico wrote: > > Though tongue-in-cheek, this talk shows (along the way) some of the > costs of preemption, and thus some of the possibilities you'd open up > if you could go back to cooperation. While I don't think the time is > right for *operating systems*

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Paul Moore
On 11 August 2016 at 01:41, Chris Angelico wrote: > I've almost never seen files stored in UTF-32 (even UTF-16 isn't all > that common compared to UTF-8), so I wouldn't stress too much about > that. Recognizing FE FF or FF FE and decoding as UTF-16 might be worth > doing, but it could easily be re

Re: [Python-ideas] PEP 525: Asynchronous Generators

2016-08-11 Thread Nick Coghlan
On 11 Aug 2016 18:48, "Cory Benfield" wrote: > > While we’re talking about function colour, we should note that you don’t *have* to have function colour. A quick look at your average Twisted codebase that doesn’t use @inlineCallbacks will quickly show you that you can write an asynchronous program

Re: [Python-ideas] PEP 525: Asynchronous Generators

2016-08-11 Thread Cory Benfield
> On 11 Aug 2016, at 13:00, Nick Coghlan wrote: > Twisted callbacks are still red functions - you call them via the event loop > rather than directly, and only event loop aware functions know how to make > that request of the event loop. > > async/await just makes the function colour locally v

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Steven D'Aprano
On Thu, Aug 11, 2016 at 02:09:00PM +1000, Chris Angelico wrote: > On Thu, Aug 11, 2016 at 1:14 PM, Steven D'Aprano wrote: > > The way I have done auto-detection based on BOMs is you start by reading > > four bytes from the file in binary mode. (If there are fewer than four > > bytes, it cannot be

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Random832
On Thu, Aug 11, 2016, at 10:25, Steven D'Aprano wrote: > > Interesting. Are you assuming that a text file cannot be empty? > > Hmmm... not consciously, but I guess I was. > > If the file is empty, how do you know it's text? Heh. That's the *other* thing that Notepad does wrong in the opinion of

Re: [Python-ideas] PEP 525: Asynchronous Generators

2016-08-11 Thread Thomas Güttler
Am 10.08.2016 um 19:17 schrieb Sven R. Kunze: On 09.08.2016 05:23, Nick Coghlan wrote: On 9 August 2016 at 08:37, Sven R. Kunze mailto:[email protected]>> wrote: From what I've heard in the wild, that most if not all pieces of async are mirroring existing Python features. So, building

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Steve Dower
Unless someone else does the implementation, I'd rather add a utf8-readsig encoding that initially only skips a utf8 BOM - notably, you always get the same encoding, it just sometimes skips the first three bytes. I think we can change this later to detect and switch to utf16 without it being di

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Chris Angelico
On Fri, Aug 12, 2016 at 1:31 AM, Steve Dower wrote: > My big concern is the console... I think that change is inevitably going to > have to break someone, but I need to map out the possibilities first to > figure out just how bad it'll be. Obligatory XKCD: https://xkcd.com/1172/ Subprocess invoc

Re: [Python-ideas] PEP 525: Asynchronous Generators

2016-08-11 Thread Cory Benfield
> On 11 Aug 2016, at 16:22, Thomas Güttler wrote: > > The user there writes: [about await] That sounds quite like Cooperative > multitasking to me. > > In 1996 I was a student at university and was told that preemptive > multitasking is better. > > Since tools like http://python-rq.org/ can

Re: [Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484

2016-08-11 Thread Eric Snow
On Tue, Aug 9, 2016 at 5:32 PM, Eric Snow wrote: > There are a number of options here for identifying attributes > in a definition and even auto-generating parts of the class (e.g. > __init__). Let's look at several (with various objectives): > > # currently (with comments for type info) > # usin

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Adam Bartoš
> > On 11 August 2016 at 04:10, Steve Dower > wrote: > >>* I suspect there's a lot of discussion to be had around this topic, so I > >>want to get it started. There are some fairly drastic ideas here and I need > >>help figuring out whether

Re: [Python-ideas] Fix default encodings on Windows

2016-08-11 Thread Adam Bartoš
Eryk Sun wrote: > IMO, Python needs a C implementation of the win_unicode_console > module, using the wide-character APIs ReadConsoleW and WriteConsoleW. > Note that this sets sys.std*.encoding as UTF-8 and transcodes, so > Python code never has to work directly with UTF-16 encoded text. > > The t