I guess there are two use cases: (1) Code carefully written to avoid yield as well as yield from.
(2) Code written using yield-from, aiming at Python 3.3 and higher, or code written using yield, aiming at Python 3.2 and earlier (including Python 2). For (1), having the package name always be asyncio is easier, because it could work with either Trollius or Tulip; but for (2), since you have to edit the code anyway to switch between yield and yield-from, it seems different package names would be simpler, since it keeps the door open (at least in 3.3 and above) to using Trollius and Tulip in the same process. Thinking about it more, in 3.3+ it should indeed be possible to share an event loop between Trollius and Tulip; you could even have a way to install an event loop policy that ensures the loops are shared. I'm sure there are some issues that might get in the way, but it sounds like Tulip's interoperability design *should* support this -- if it can't I'd be happy to entertain improvements to make it work (assuming the changes don't require Tulip-only users to change their code). On Mon, May 12, 2014 at 9:16 AM, Victor Stinner <[email protected]>wrote: > 2014-05-12 16:53 GMT+02:00 Guido van Rossum <[email protected]>: > > I think the package should always be called trollius and the import > should > > be recommended to be > > > > import trollius as asyncio > > It means that code written for Tulip and Trollius will need to be > modified to use: > > try: > from asyncio import ... # Tulip, Python 3.4+ > except ImportError: > from trollius import ... # Trollius for Python < 3.3 > > A similar pattern is used for code working on Python 2 and Python 3, > but it's not surprising. > > But it opens a new question: would it be possible to mix code using > Trollius (trollius) and Tulip (asyncio) in the same process? I mean > use the same event loop. A Trollius event loop should be used to > support Trollius coroutines (using yield). Would it possible to use > Tulip code (ex: aiohttp) with such loop? > > I should play with such setup to see how it can work :-) > > A "trollius" module name would avoid confusion between Tulip (yield > from) and Trollius (yield). > > Victor > -- --Guido van Rossum (python.org/~guido)
