On 1/11/2014 1:44 AM, Stephen Hansen
wrote:
There's been a number of examples given: PDF, HTTP,
network streams that switch inline from text-ish to binary and
back-again.. But, we can focus that down to a very narrow and not
at all uncommon situation in the latter.
PDF has been mentioned a few times. ReportLAB recently decided to
convert to Python 3, and fairly quickly (from my perspective, it
took them a _long_ time to decide to port, but once they decided to,
then it seemed quick) produced an alpha version that passes many of
their tests. I've not tried it yet, although it interests me, as I
have some Python 2 code written only because ReportLAB didn't
support Python 3, and I wanted to generate some PDF files. I'll be
glad to get rid of the Python 2 code, once they are released.
But I guess they figured out a solution that wasn't onerous, I'd
have to go re-read the threads to be sure, but it seems they are
running one code base for both... not sure of the details of what
techniques they used, or if they ever used the % operator :)
But I'm wondering, since they did what they did so quickly, if the
"mixed bytes and str" use case is mostly, in fact, a mind-set
issue... yes, likely some code has to change, but maybe the changes
really aren't all that significant.
I wouldn't want to drag them into this discussion, I'd rather they
get the port complete, but it would be interesting to know what they
did, and how they did it, and what problems they had, etc. If anyone
here knows that code a bit, perhaps the diffs could be examined in
their repository to figure out what they did, and how much it
impacted their code. I do know they switched XML parsers along the
way, as well as dealing with string handling differences.