Closed snoack closed 9 years ago
I really appreciate this PR, but I'd rather it continued to work in Python 2 as well as Python 3. I'm prepared to accept a dependency on six
or future
if necessary.
This does work on Python 2.7 (maybe even 2.6) as well as on Python 3. That is because bytes
has been added as alias for str
on Python 2 in order to make supporting Python 2 and 3 with the same code easier.
Yes, but the print function won't work unless you add from __future__ import print_function
at the top of the file ;-)
Maybe a tox config script would be a useful thing - I had planned to add one ;-)
print(<expr>)
works even in Python 2.3. ;) That is because it's not interpreted as function call, but the parenthesis merely group the expression provided to the print
statement, while the same code is interpreted as function call in Python 3. You only need from __future__ import print_function
if you want to use the additional/optional arguments of the print function.
Much as I like evil, that seems like the wrong kind of evil ;-)
Not sure, if I agree. But here comes a new patch using from __future__ import print_function
. I also rebased.
It's a shame that I cannot use the awesome ish library in Python 3. Fortunately, it turned out that porting it were trivial. While doing so I'll also fixed following issues, while touching that lines anyway:
replace
parameter to.decode()
call to preventUnicodeDecodeError
s when callingb'ä' == True-ish
for example