[Python-ideas] python on mobile

Chris Angelico rosuav at gmail.com
Tue Dec 30 04:51:13 CET 2014

On Tue, Dec 30, 2014 at 7:48 AM, Fetchinson . <fetchinson at googlemail.com> wrote:
>> Python 3 isn't just better for large projects. It's better for _every_
>> project. Just because you think you won't ever need non-ASCII
>> characters doesn't mean you won't ever get any; why not take the easy
>> way out and use Py3? (Case in point: I just sent through a pull
>> request on a project that had a ≤ (U+2264) in a comment. Py2
>> complained because it used a non-ASCII character and didn't have a
>> coding cookie. Py3 would have accepted it, though sadly it wasn't a
>> Py3-compatible script for other reasons. ASCII simply isn't enough.)
> I'm not sure I understand you. Are you saying unicode support is not
> there in python 2? That's certainly not the case. I believe that
> python 3 is more *convenient* but certainly is not necessary, it's
> perfectly possible to handle any character set in python 2 as well.

You can handle data in any character set using Py2. Explicitly convert
to Unicode, work with that, off you go. No problem. You can do that in
any language that has encode and decode libraries. The difference is
that in Py2, you can forget that you have to encode and decode, and
your program will work on ASCII text - and then you'll blame "funny
characters" for breaking your program. In Py3, you'll get it right
straight off, and it'll work for all of Unicode equally.

Plus, Py3 makes the default source code encoding UTF-8 instead of
ASCII, so you can have non-ASCII comments without having to slap a
coding cookie at the top of the file; and since source code is Unicode
text rather than bytes, you can reliably use non-ASCII variable names,
module names (I think), and even, with a few tweaks, alternate
language keywords. Basically, where Py2 gives you the tools to make a
Unicode-aware program, Py3 just makes your program Unicode-aware for

We're definitely off-topic for python-ideas now.


More information about the Python-ideas mailing list