[Python-ideas] Re: Add «iterate non-blocking» wrapper to prevent blocking loop too long

2019-06-15 Thread Gustavo Carneiro
On Sat, 15 Jun 2019 at 00:26, Greg Ewing wrote: > Gustavo Carneiro wrote: > > 1. If you don't yield in the for loop body, then you are blocking the > > main loop for 1 second; > > > > 2. If you yield in every iteration, you solved the task switch latency > > problem, but you make the entire progr

[Python-ideas] Re: Add «iterate non-blocking» wrapper to prevent blocking loop too long

2019-06-15 Thread Barry Scott
> On 15 Jun 2019, at 10:55, Gustavo Carneiro wrote: > > > Perhaps. But using threads is more complicated. You have to worry about the > integrity of your data in the face of concurrent threads. And if inside your > task you sometimes need to call async coroutine code, again you need to b

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-15 Thread Franklin? Lee
On Fri, Jun 14, 2019, 13:49 Brett Cannon wrote: > I think the logic breaks down with multiple inheritance. If you make C(A, B), > then you can say C > A and C > B, but then you can't say A > B or A < B which > breaks sorting. The logic is fine. Classes can be considered as containers of their i

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-15 Thread Guido van Rossum
I don't actually know how viable this proposal is, but given that it's being debated at some length, I'd like to put in my opinion that *if* we're going to define an operator that's (roughly) synonymous with issubclass(), it should be '<:', which is used in other languages (e.g. Scala) and notatio

[Python-ideas] Re: Add «iterate non-blocking» wrapper to prevent blocking loop too long

2019-06-15 Thread Joao S. O. Bueno
Despite my concerns over code for an implementation on my previous e-mail, it turns out that simply iterating in an `async for` loop won't yield to the asyncio-loop. An explicit "await" inside the async-generator is needed for that. That makes factoring-out the code presented in the first e-mail i