Open graingert opened 3 years ago
A common pattern in 2/3 compatible codebases is to wrap new Python 3 syntax with exec or eval with a string literal.
Examples can be seen six.reraise, various bits of twisted and tulip:
This also applies to 3.6-3.10 codebases for example positional only arguments:
if sys.version_info >= (3, 8): exec( """def fancyStuff(fn, \, ham, spam): ... """ ) else: def fancyStuff(args, ham, spam): fn, *args = args ...
I think this would be really difficult to do in the general case, but certainly possible
A common pattern in 2/3 compatible codebases is to wrap new Python 3 syntax with exec or eval with a string literal.
Examples can be seen six.reraise, various bits of twisted and tulip:
This also applies to 3.6-3.10 codebases for example positional only arguments: