Because I like Python and have spent some time with it, I recognize some of its downsides. These criticisms are meant to be constructive.

Python 3 introduces breaking changes into the language

It's common for code written for Python 2 to not work on Python 3. This is an unfortunate situation and means lots of code has been or needs to be ported. Once the dust settles and no one uses Python 2 anymore, this will be a non-issue. Until then https://pythonclock.org and http://python3statement.org are good sites to keep an eye on to see the latest news on the transistion.

Over at https://matthiasbussonnier.com/posts/planning-an-early-death-for-python-2.html which was discussed at https://pythonbytes.fm/episodes/show/5/legacy-python-vs-python-and-why-words-matter-and-request-s-5-whys-retrospective it is argued that Python 2 should be referred to as "Legacy Python" to emphasize that it is going end of life soon.

In https://github.com/python/devguide/pull/344 the date after which Python 2.x will no longer receive security updates has been finalized as January 1st, 2020.

I remember when Steve Jobs gave a eulogy over Mac OS 9 in a casket and I feel like the Python community would benefit from watching it. The similarities are striking.

Python's signficant white space prevents quick experimentation with code you paste in

For me, one of the major downsides of Python is that it doesn't allow me to paste code into existing code and worry about reformating it (programmatically) later. Rather, Python insists that I adjust the indentation first or else the meaning of the code is changed. In my mind, this prevents me from trying quick experiements with code I've just pasted in.

TODO: Rewrite this example using go fmt and mention the section about "mechanical source transformation" at https://blog.golang.org/go-fmt-your-code especially "Mechanical transformation is invaluable when working with large code bases, as it is both more comprehensive and less error prone than making wide-sweeping changes by hand."

Let me try to illustrate with an example, contrasting Python with a language that doesn't have signficant whitespace (Perl):

Let's say I have the following Perl code (with use v5.10 for say):

if (1) {
    for ( 0 .. 2 ) {
        say "hello world";
    }
    # FIXME: add inner for loop?
}

It prints the following:

hello world
hello world
hello world

Now, let's say I want to nest another for loop inside the existing loop to produce the following output:

hello world
goodbye world
goodbye world
goodbye world
hello world
goodbye world
goodbye world
goodbye world
hello world
goodbye world
goodbye world
goodbye world

Here's where you have to bear with me... let's pretend that the code to produce "goodbye world" is long enough that you grab it from some other project you've already worked on. The indenting is off but you paste it in as a quick test and it works fine. Your code is a little ugly at the moment, but it works:

if (1) {
    for ( 0 .. 2 ) {
        say "hello world";
for ( 0 .. 2 ) {
    say "goodbye world";
}
    }
}

Since the test works, you run the code through perltidy to clean it up. Now it looks like this:

if (1) {
    for ( 0 .. 2 ) {
        say "hello world";
        for ( 0 .. 2 ) {
            say "goodbye world";
        }
    }
}

Now, let's talk about Python. You paste the "goodbye world" code in...

if 1:
    for x in range (0,3):
        print 'hello world'
for x in range (0,3):
    print 'goodbye world'

... but it doesn't give the desired output above. Rather, it prints this:

hello world
hello world
hello world
goodbye world
goodbye world
goodbye world

You have to go fix the indenting before you get the meaning you want. Here's the version that produces the desired output:

if 1:
    for x in range (0,3):
        print 'hello world'
        for x in range (0,3):
            print 'goodbye world'

Home | About | Sitemap | Recent changes | © Philip Durbin | @philipdurbin | philipdurbin@gmail.com