from __past__ import bytestring_literals, loose_comparison, integer_division, ...
? Being able to upgrade one file at a time to Py3 would have made porting so much easier! I realize some things could be hard to support file-at-a-time, but others (like my examples) would obviously not.
I've held off on porting the Py2 code that I'm responsible for because of the lack of total test coverage. I know that something tricky with unicode, None comparison, or the list->generator split will cause a failure in a weird, untested edge case. If I were making a numeric library, that'd be one thing. However, I mostly write complicated business logic API glue code that is hard to test without huge amounts of mocks.
Also, this kind of thing gives me nightmares about porting:
WSGI therefore defines two kinds of "string":
"Native" strings (which are always implemented using the type named str ) that are used for request/response headers and metadata
"Bytestrings" (which are implemented using the bytes type in Python 3, and str elsewhere), that are used for the bodies of requests and responses (e.g. POST/PUT input data and HTML page outputs).
So according to the spec (!) WSGI headers MUST be `str` in Python 2 & 3, but that means that the semantic meaning of the types changes. How on earth am I supposed to write good code for working with headers (let alone mocking and testing) when I'm required to decode them in Python 2 but not in Python 3?
I've held off on porting the Py2 code that I'm responsible for because of the lack of total test coverage. I know that something tricky with unicode, None comparison, or the list->generator split will cause a failure in a weird, untested edge case. If I were making a numeric library, that'd be one thing. However, I mostly write complicated business logic API glue code that is hard to test without huge amounts of mocks.
Also, this kind of thing gives me nightmares about porting:
So according to the spec (!) WSGI headers MUST be `str` in Python 2 & 3, but that means that the semantic meaning of the types changes. How on earth am I supposed to write good code for working with headers (let alone mocking and testing) when I'm required to decode them in Python 2 but not in Python 3?