On Thursday, November 24, 2016 at 7:35:03 PM UTC, bream...@gmail.com wrote:
> It's all here https://learnpythonthehardway.org/book/nopython3.html although 
> I strongly suggest that people have large piles of sedatives to hand before 
> reading the article.  Does me a favour though, i've been looking for another 
> member of my dream team for some time.
> 
> Kindest regards.
> 
> Mark Lawrence.

I think the article is full of factual errors and is at best misleading and at 
worst downright dishonest in its criticisms of Python 3. (My only serious 
complaint about Python is that it doesn't support a key-ordered dict.) Anyway, 
here are my initial responses to some of the articles "points".

The article claims:

    "There is a high probability that Python 3 is such a failure it will kill 
Python."

This is despite the fact that there are more Python programmers than ever 
before, that there is more investment in Python programming, tools, and 
libraries than ever before, and that more and more new projects start out as 
Python 3 only.

The article says:

    "Also, it's been over a decade, maybe even multiple decades, and Python 3 
still isn't above about 30% in adoption."

Python 3.0 was released in 2008, so it hasn't been a single decade. According 
to an analysis of PyPI downloads, Python 2-only packages have steadily declined 
in the past 5 years with Python 3-only packages steadily rising and about to 
overtake, and with a steady rise in packages that support both:
https://blogs.msdn.microsoft.com/pythonengineering/2016/03/08/python-3-is-winning/
The Python 3 Readiness web site:
http://py3readiness.org/
shows that today, 341 out of 360 of Python's most popular packages are Python 3 
compatible.

The article says:

    "The fact that you can't run Python 2 and Python 3 at the same time"

This is untrue. Most Linux distributions not only ship with Python 2 and Python 
3, but often end up with both installed. Modern versions of Fedora and Ubuntu 
depend on Python 3, but allow Python 2 to be installed side-by-side to support 
older software. On Windows it is easy to install both Python 2 and Python 3 and 
the py.exe that comes with Python 3 will detect which Python version is 
required and use it, if it is installed.

The article says:

    "Every time you attempt to deal with characters in your programs you'll 
have to understand the difference between byte sequences and Unicode strings."

If you are doing low-level networking or other low-level programming dealing 
with raw bytes this is true. But for application programming you just put your 
strings in quotes and they work fine. And if you're in a non-English 
environment, you still just put your strings in quotes and they still work 
fine. But in Python 2, for non-English environments you need to add an encoding 
comment at the top of each file and you may have to use Unicode escapes.

Working with strings in Python 3 is easier than in Python 2 since you always 
know they are Unicode whereas in Python 2 they can be in any 8-bit encoding 
depending on the encoding comment, the environment, or where they came from.

And working with raw bytes is easier in Python 3 because of the bytes and 
bytearray objects which are optimized for use with bytes rather than Python 2's 
jack of all trades str type.

The article has a section called:

    "Core Libraries Not Updated"

All of Python's core libraries were updated for Python 3, and further updating 
is an ongoing process. In general, if you have a library that can work with 
bytes or strings, the library will accept either and return the same type. So, 
for example, if you use the regex library, re, and give it a bytes object, any 
matches will be bytes objects, but if you give it string, any matches will be 
strings.

The article has a section called:

    "Python 3 Is Not Turing Complete"

This would be laughable if it wasn't being said straight. He claims that 
"Currently you cannot run Python 2 inside the Python 3 virtual machine." and 
that this 'proves' that Python 3 isn't Turing complete.

It is true that you can't run Python 2 code in a Python 3 interpreter (unless 
you use six), but that says nothing about whether Python 3 is Turing complete 
or not. Turing completeness depends on whether a language supports certain 
computational features, such as branching and unbounded looping, and Python 3 
(and Python 2) have all the necessary features.

What he doesn't seem to understand is that Python 3 (or any other Turing 
complete language), can be used to _write an interepreter_ for any other 
language. So, a Python 2 interpreter could be written in Python 3, but no one 
has done so because there's no point when it is far easier to port Python 2 to 
Python 3, especially since Python 2 support will cease in a few years time.

The article has a section called:

    "Purposefully Crippled 2to3 Translator"

This section is incredibly insulting to the Python developers. The reason that 
2to3 is imperfect is because like so many other things, it is fairly easy to 
get an 80% solution, but incredibly difficult to go much further. In addition, 
with the creation of the six library, it became possible to write code that was 
both Python 2 and Python 3 compatible, so people who want both can have it in 
the same code base without the need for 2to3. And those who don't need Python 
2, don't need 2to3 (except maybe once to help with an initial port) or six.

The article has a section called:

    "Statically Typed Strings"

The title is wrong of course because Python uses dynamic typing. But his chief 
complaint seems to be that you can't mix strings and bytes in Python 3. That's 
a deliberate design choice that several Python core developers have explained. 
Essentially they are saying that you can't concatenate a bunch of raw bytes 
with a string in the same way that you can't add a set to a list -- and this 
makes perfect sense because raw bytes could be just bytes, or they could be a 
representation of text in which case by specifying the encoding (i.e., 
converting them to a string) the concatenation can take place. And this is in 
keeping with Python's core philosphy of being explicit.

The article has a section called:

    "Too Many Formatting Options"

He's right! The % formatting was kept to help port old code, the new .format() 
which is far more versatile is a bit verbose, so finally they've settled on 
f-strings. So, you do need to know that all three exist (e.g., for maintaining 
code), but you can easily choose the style that you prefer and just use that.

Conclusion

I have taught Python to many people and written books on Python. I started 
using Python 3 from the first alpha and by the first beta I'd (manually) ported 
all my own tools and utilities to it. I also develop commercial software, all 
of which is written in Python 3 which I find far easier to use in part 
_because_ of the clear text vs. bytes distinction, plus a number of other 
smaller improvements (unambiguous except blocks) etc. And certainly, I think 
that Python 3 is much easier to learn than Python 2. The first thing I always 
had to do when teaching Python 2 was explain why print was different from 
everything else (i.e., because it was a statement, not a function, and so 
didn't need parentheses around its arguments), but for Python 3 print() is just 
like a function you create yourself.

I've been using Python 3 very happily for 8 years now and it seems to get 
better and better with each new release.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to