[python-tulip] Re: Best practice for managing loop: don't close it (really!?)

2015-01-18 Thread Luciano Ramalho
Ok, that makes sense, thanks! On Sunday, January 18, 2015, Guido van Rossum gu...@python.org wrote: Yes. It's a bit like memory allocation -- if you don't own it, don't free it. On Sun, Jan 18, 2015 at 3:41 PM, Luciano Ramalho luci...@ramalho.org javascript:_e(%7B%7D,'cvml','luci

Re: [python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-19 Thread Luciano Ramalho
On Mon, Jan 19, 2015 at 12:02 PM, Victor Stinner victor.stin...@gmail.com wrote: 2015-01-19 12:52 GMT+01:00 Luciano Ramalho luci...@ramalho.org: In a non-trivial program, how do I know mine was the first call to get_event_loop? It doesn't matter who called it first. You may even call close

Re: [python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-19 Thread Luciano Ramalho
, delegating the decision to actually close() the loop to the same infrastructure level that makes the decision to create a new loop or give me an existing one when I call get_event_loop. What do you think? Best, -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter

Re: [python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-19 Thread Luciano Ramalho
In my previous message the crucial word NOT was missing from this sentence: Even a trivial program running in iPython Notebook under Qt will get an event loop that already existed, and that it should NOT close. Sorry... Best, Luciano On Mon, Jan 19, 2015 at 9:52 AM, Luciano Ramalho luci

[python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-18 Thread Luciano Ramalho
it. [1] http://bugs.python.org/issue19860#msg205062 Can I conclude that in practice, close() should not be called at all unless your own code actually created the loop instead of merely fetching it with asyncio.get_event_loop()? Is that a sensible recommendation? Cheers, Luciano -- Luciano

Re: [python-tulip] Proposal: make coroutines stand out in the asyncio docs.

2015-02-12 Thread Luciano Ramalho
as such? The asyncio code often uses the inspect module to determine the kind of function, right? Best, Luciano -- Ludovic Gasc On Thu, Feb 12, 2015 at 6:24 PM, Luciano Ramalho luci...@ramalho.org wrote: On Thu, Feb 12, 2015 at 2:35 PM, Ben Darnell b...@bendarnell.com wrote: But then the coroutine

Re: [python-tulip] Re: Call protocol.connection_lost() when the creation of transport failed?

2015-01-29 Thread Luciano Ramalho
Rossum (python.org/~guido) -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter: @pythonprobr

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Luciano Ramalho
Reviving the thread... if I understand correctly, there is no portable way to do disk I/O asynchronously (and the gist [1] provided by the OP is bogus: the read_data function will block the event loop). Is my understanding correct? [1] https://gist.github.com/kunev/f83146d407c81a2d64a6

Re: [python-tulip] Proposal: make coroutines stand out in the asyncio docs.

2015-02-12 Thread Luciano Ramalho
a new one (unless I'm missing something), but this seems like a good addition for the next version of sphinx. You are right, Ben, the best solution seems to be a sphinx extension to generate markup like those classmethod tags. Cheers, Luciano -- Luciano Ramalho Twitter: @ramalhoorg Professor em

[python-tulip] Which is the canonical repo for the tulip/asyncio examples?

2015-03-18 Thread Luciano Ramalho
I use? Thanks! Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg

Re: [python-tulip] Which is the canonical repo for the tulip/asyncio examples?

2015-03-18 Thread Luciano Ramalho
/examples/crawl.py Which permantent URL should I use? Thanks! Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg -- --Guido van Rossum (python.org

[python-tulip] asyncio.async versus loop.create_task

2015-03-22 Thread Luciano Ramalho
asyncio.async is deprecated? The docs seem to imply ever-so-slightly that create_task is better and async should be used to support also older Python versions. Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do

Re: [python-tulip] Which is the canonical repo for the tulip/asyncio examples?

2015-03-18 Thread Luciano Ramalho
could not find the chapter where asyncio is covered. I'd like to link to that too. I will link to the aosabook repo for the code. Cheers, Luciano On Wed, Mar 18, 2015 at 10:14 AM, Luciano Ramalho luci...@ramalho.org wrote: I want to link to Guido's web crawler example in my book, Fluent

Re: [python-tulip] Async iterators

2015-03-24 Thread Luciano Ramalho
/fs.html For convenience, some functions have a non-callback synchronous version. Those have a Sync suffix, e.g. fs.stat(path, callback) fs.statSync(path) Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do

Re: [python-tulip] asyncio.async versus loop.create_task

2015-03-26 Thread Luciano Ramalho
a task that behaves better with some other framework (e.g. Tornado). Also note that async() calls create_task(), but only when it decides to create a new task. Maybe the docs need an upgrade, please submit a patch. On Sun, Mar 22, 2015 at 7:32 AM, Luciano Ramalho luci...@ramalho.org wrote

Re: [python-tulip] Which other futures my come out of asyncio.as_completed?

2015-02-27 Thread Luciano Ramalho
is indeterminate until a result is ready. Excellent, thank you for that! Best, Luciano On Fri, Feb 27, 2015 at 12:42 PM, Luciano Ramalho luci...@ramalho.org wrote: Hello, in the docs for the asyncio.as_completed function [1] there's a note that says The futures f are not necessarily members of fs. [1

Re: [python-tulip] Which other futures my come out of asyncio.as_completed?

2015-03-01 Thread Luciano Ramalho
/error of the new future will be the same as the original future. [1] https://docs.python.org/3/library/asyncio-task.html#asyncio.as_completed Best, Luciano On Fri, Feb 27, 2015 at 12:42 PM, Luciano Ramalho luci...@ramalho.org wrote: Hello, in the docs for the asyncio.as_completed function [1

Re: [python-tulip] asyncio.async versus loop.create_task

2015-03-26 Thread Luciano Ramalho
last message to that thread. I even wrote to you in private asking for a permanent URL for it, so I can link to it from my book. Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http

Re: [python-tulip] Is async object creation supported?

2015-05-16 Thread Luciano Ramalho
(): yield from some async code class Y: def __init__(): some sync code def init(): yield from some async code -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br

[python-tulip] [announce] yield-from and asyncio coverage available in Fluent Python

2015-04-17 Thread Luciano Ramalho
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg

Re: [python-tulip] asyncio_tkinter doesn't work

2015-04-05 Thread Luciano Ramalho
. Thank you Guido and Alan for helping me with this, and Dino for the awesome talk and example! Victor: I made a pull request so you can merge this with the haypo/asyncio_staging repo on Bitbucket. Thanks! Best, Luciano On Sun, Jan 25, 2015 at 10:39 PM, Luciano Ramalho luci...@ramalho.org wrote: I

Re: [python-tulip] asyncio_tkinter doesn't work

2015-04-05 Thread Luciano Ramalho
On Sun, Apr 5, 2015 at 10:12 AM, Luciano Ramalho luci...@ramalho.org wrote: Alan Cristhian (@AlanCristhian on Github) fixed the hang-on-exit bug by turning the asyncio event loop thread into a daemon; see guievents.py, method GuiEventLoop._start_io_event_loop. Ah, yes, my code is in this repo

Re: [python-tulip] Handling a StreamReader data buffer when calling .read() with no arguments

2015-07-30 Thread Luciano Ramalho
with understanding how to read() continuously since the documentation examples are just reading single lines or to the EOF. -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter

[python-tulip] Video: "Plate Spinning", a gentle introduction to asyncio

2015-09-08 Thread Luciano Ramalho
hurry now. Despite that Q mishap, I think the talk is a pretty good introduction to the way asyncio works. What do you think? Your feedback is most welcome! Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Pr

Re: [python-tulip] Motor, the async MongoDB driver, now supports asyncio

2015-12-04 Thread Luciano Ramalho
it still works with Tornado. > > Peace, > Jesse -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg

Re: [python-tulip] Suggestions for topics in an asyncio 2-hour workshop targeting beginner/intermediate Python users?

2018-01-22 Thread Luciano Ramalho
> demonstrate, considering the time constrains including a minimal explanation > or the possibility to include complimentary textual resources to be read > afterwards the workshop? > > As an example, I would focus in an application client, probably to web > context, but it is not a defi