Re: [Python-Dev] Unicode literals in Python 2.7

2015-05-07 Thread Martin v. Löwis
Am 02.05.15 um 21:57 schrieb Adam Bartoš: > Even if sys.stdin contained a file-like object with proper encoding > attribute, it wouldn't work since sys.stdin has to be instance of 'file'>. So the question is, whether it is possible to make a file instance > in Python that is also customizable so i

Re: [Python-Dev] PEP 492: async/await in Python; version 5

2015-05-07 Thread Yury Selivanov
On 2015-05-07 1:42 PM, Guido van Rossum wrote: On Tue, May 5, 2015 at 3:36 PM, Rajiv Kumar wrote: I wrote a little example[1] that has a bare-bones implementation of Go style channels via a custom event loop. I used it to translate the prime sieve example from Go[2] almost directly to Python

Re: [Python-Dev] PEP 492: async/await in Python; version 5

2015-05-07 Thread Guido van Rossum
On Tue, May 5, 2015 at 3:36 PM, Rajiv Kumar wrote: > I wrote a little example[1] that has a bare-bones implementation of Go > style channels via a custom event loop. I used it to translate the prime > sieve example from Go[2] almost directly to Python. The code uses "message > = await channel.rec

Re: [Python-Dev] What's missing in PEP-484 (Type hints)

2015-05-07 Thread Guido van Rossum
On Thu, May 7, 2015 at 7:25 AM, Dima Tisnek wrote: > On 30 April 2015 at 14:33, Steven D'Aprano wrote: > > On Thu, Apr 30, 2015 at 01:41:53PM +0200, Dima Tisnek wrote: > >> # internal vs external > >> @intify > >> def foo() -> int: > >> b = "42" > >> return b # check 1 > >> x = foo() //

Re: [Python-Dev] What's missing in PEP-484 (Type hints)

2015-05-07 Thread Dima Tisnek
>> # plain data >> user1 = dict(id=123, # always int >> name="uuu", # always str >> ...) # other fields possible >> smth = [42, "xx", ...] >> (why not namedtuple? b/c extensible, mutable) >> At least one PHP IDE allows to annotate PDO. >> Perhaps it's just bad taste in Python? Or is ther

Re: [Python-Dev] What's missing in PEP-484 (Type hints)

2015-05-07 Thread Dima Tisnek
On 30 April 2015 at 14:33, Steven D'Aprano wrote: > On Thu, Apr 30, 2015 at 01:41:53PM +0200, Dima Tisnek wrote: > >> # Syntactic sugar >> "Beautiful is better than ugly, " thus nice syntax is needed. >> Current syntax is very mechanical. >> Syntactic sugar is needed on top of current PEP. > > I t

Re: [Python-Dev] PEP 492 quibble and request

2015-05-07 Thread Ron Adam
On 05/03/2015 03:03 PM, Arnaud Delobelle wrote: On 3 May 2015 at 02:22, Greg Ewing wrote: >Guido van Rossum wrote: >> >>On Sat, May 2, 2015 at 1:18 PM, Arnaud Delobelle >> wrote: >> >> Does this mean that >> somehow "await x" guarantees that the coroutine wi

Re: [Python-Dev] Accepting PEP 492 (async/await)

2015-05-07 Thread Ludovic Gasc
Thank you Yuri for the all process (PEP+code+handle debate). It's the first time I follow the genesis of a PEP, from the idea to the acceptation, it was very instructive to me. -- Ludovic Gasc (GMLudo) http://www.gmludo.eu/ 2015-05-06 1:58 GMT+02:00 Guido van Rossum : > I totally forgot to publ

Re: [Python-Dev] PEP 492: async/await in Python; version 5

2015-05-07 Thread Ryan Hiebert
This draft proposal for async generators in ECMAScript 7 may be interesting reading to those who haven’t already: https://github.com/jhusain/asyncgenerator This talk also has some good ideas about them, though the interesting stuff about using async g

Re: [Python-Dev] Ancient use of generators

2015-05-07 Thread David Mertz
I'm glad to see that everything old is new again. All the stuff being discussed nowadays, even up through PEP 492, was largely what I was trying to show in 2002 the syntax just got nicer in the intervening 13 years :-). On Wed, May 6, 2015 at 10:57 AM, Guido van Rossum wrote: > For those i

Re: [Python-Dev] PEP 492 quibble and request

2015-05-07 Thread Arnaud Delobelle
On 3 May 2015 at 02:22, Greg Ewing wrote: > Guido van Rossum wrote: >> >> On Sat, May 2, 2015 at 1:18 PM, Arnaud Delobelle > > wrote: >> >> Does this mean that >> somehow "await x" guarantees that the coroutine will suspend at least >> once? > > > No. First, i

Re: [Python-Dev] Minimal async event loop and async utilities (Was: PEP 492: async/await in Python; version 4)

2015-05-07 Thread Paul Sokolovsky
Hello, On Wed, 6 May 2015 09:27:16 +0100 Paul Moore wrote: > On 6 May 2015 at 07:46, Greg Ewing > wrote: > > Another problem with the "core" idea is that > > you can't start with an event loop that "just does > > scheduling" and then add on other features such > > as I/O *from the outside*. The

Re: [Python-Dev] PEP 492: async/await in Python; version 4

2015-05-07 Thread Arnaud Delobelle
On 3 May 2015 at 16:24, Steven D'Aprano wrote: > On Fri, May 01, 2015 at 09:24:47PM +0100, Arnaud Delobelle wrote: > >> I'm not convinced that allowing an object to be both a normal and an >> async iterator is a good thing. It could be a recipe for confusion. > > In what way? > > I'm thinking tha

Re: [Python-Dev] PEP 492: async/await in Python; version 5

2015-05-07 Thread Rajiv Kumar
I wrote a little example[1] that has a bare-bones implementation of Go style channels via a custom event loop. I used it to translate the prime sieve example from Go[2] almost directly to Python. The code uses "message = await channel.receive()" to mimic Go's "message <- channel". Instead of using