2 ms·
I made all my Py2 code forward compatible with 2to3. It was mostly a smooth process when you're using the future imports and know what landmines to avoid. It st
by kevin_thibedeau 6y ago
I made all my Py2 code forward compatible with 2to3. It was mostly a smooth process when you're using the future imports and know what landmines to avoid. It still required manual intervention at times with Unicode support and libraries that have breaking API changes between versions.
The end result is something that can be Py3 native whenever I want. 2to3 is the right tool for the job. There is no way to map all Py3 features back into Py2 so 3to2 would be a broken mess that only supported a subset of the language.
- kqr 6y ago> There is no way to map all Py3 features back into Py2 so 3to2 would be a broken mess that only supported a subset of the language. Oh but there is. If you can map them to bytecode, you can map them to Python 2, which is a fully capable language. It won't be a one-to-one map, but that's also not required.
- kevin_thibedeau 6y agoNot going to work for async.
- Macha 6y agoWhy not? Provide your own future implementation, transform the async code into a state machine. Babel does exactly this for JavaScript async. Sure the generated code is a horrific mess to look at but even that's a solved problem with sourcemaps if you need to debug it.