Hi,

Tulip uses "yield from" whereas this instruction is new in Python 3.3
and cannot be used on Python 2, so Trollius uses "yield" instead. The
problem is that third-party projects like aiohttp uses "yield from".

On the OpenStack mailing list, the following question was asked:
"How useful is trollius if we can't use other thirdparty libraries
written for asyncio?"

Would it be possible to support CPython 3.4 / Tulip (Python 3.3) /
Trollius (Python 2.6/2.7, but works also on Python 3) in the same code
base without duplicating almost all the code?

Trollius is currently a branch of Tulip. It's not easy to maintain it
(but I do maintain it, it's possible ;-)). I'm not sure that each
third-party project would like its own Trollius branch.

I don't know if it would be possible to replace "yield from" with
"yield" at runtime, for example when a module is imported. The Python
2 parser cannot be used for that, because "yield from" raises a syntax
error.

It may be possible to write a script replacing "yield from " with
"yield " directly in the source code, something like 2to3, but I don't
like this option.

Any idea?

Note: porting Python 3 code requires a little bit more work than just
replacing "yield from" with "yield". For example, Python 2 doesn't
support definition of functions with keyword-only parameters, doesn't
support super() (with no parameter) and use old-style class by default
(your classes have to explicitly inherit from object).

Victor

Reply via email to