[Python-ideas] Python 3000 TIOBE -3%

Terry Reedy tjreedy at udel.edu
Sat Feb 11 01:07:51 CET 2012

On 2/10/2012 3:41 AM, Stephen J. Turnbull wrote:
> Terry Reedy writes:
>>>  In python 2 there was no such a strong imposition [of Unicode
>>>  awareness on users].

The claim is that Python3 imposes a large burden on users that Python2
does not.

>>  Nor is there in 3.x.

I view that claim as FUD, at least for many users, and at least until 
the persons making the claim demonstrate it. In particular, I claim that 
people who use Python2 knowing nothing of unicode do not need to know 
much more to do the same things in Python3. And, if someone uses Python2 
with full knowledge of Unicode, that Python3 cannot impose any extra 
burden. Since I am claiming negatives, the burden of proof is on those 
who claim otherwise.

> Sorry, Terry, but you're basically wrong here.

This is not a nice way to start a response, especially when you go on to 
admit that I was right as the the user case I discussed. Here is what 
you clipped.

 >> If one only uses the ascii subset, the usage of 3.x strings is 

> True, if one sticks to pure ASCII, there's no difference to notice,

Which is a restatement what you clipped. In another post I detailed the 
*small* amount (one paragraph) that I believe such people need to know 
to move to Python3. I have not seen this minimum laid out before and I 
think it would be useful to help such people move to Python3 without FUD 

 > but that's just not possible for people who live outside of the U.S.,

Who *already* have to know about more than ascii to use Python2. The 
question is whether they have to learn *substantially* more to use Python3.

> or who share text with people outside of the U.S.
 > They need currency symbols, they have friends whose names
 > have little dots on them.

OK, real-life example. My wife has colleagues in China. They interchange 
emails (utf-8 encoded) with project budgets and some Chinese characters. 
Suppose she asks me to use Python to pick out ¥ renminbi/yuan figures 
and convert to dollars. What 'strong imposition' does Python3 make to 
learn things I would not have to know to do the same thing in Python2?

> Every single one of those is a backtrace waiting to happen.
> A backtrace on
>      f = open('text-file.txt')
>      for line in f: pass

I do not consider that adding an encoding argument to make the same work 
in Python3 to be "a strong imposition of unicode awareness". Do you? In 
order to do much other than pass, I believe one typically needs to know 
the encoding of the file, even in Python2. And of course, knowing about 
and using the one unicode byte encoding is *much* easier than knowing 
about and using the 100 or so non-unicode (or unicode subset) encodings.

To me, Python3's

   s = open('text.txt', 'utf-8').read()

is easier and simpler than either Python2 version below
(and please pardon any errors as I never actually did this)

   import codecs
   s = codecs.open('text.txt', 'utf-8').read()


   f = open('text.txt')
   s = unicode(f.read, 'utf-8')

Terry Jan Reedy

More information about the Python-ideas mailing list