in reply to Re^2: Perl or Python?
in thread Perl or Python?

First off, note that the whitespace silliness isn’t the foremost reason I just can’t like Python, but it sure is a constant irritation. Why?

When I am rearranging my code, I generally cut and paste sections together as I see fit.

With Perl, I use Vim’s = command on the entire section and the indentation is magically cleaned up in one fell swoop.

With Python, I use Vim’s = command on the entire section and have a veritable mess on my hands. No can do. I need to pay close attention and reindent everything immediately upon pasting.

Basically, the difference is that you can indicate the nesting structure of a piece of code by asserting it with one visible extra character every dozen lines or so and let the computer work out the formatting from that; or you can specify the nesting structure of a piece of code by re-asserting it on every single line with multiple invisible characters and be unable to request any help with it. I thought computers were supposed to automate dronework.

I shuffle code around often enough that it matters to me: I generally postpone structuring code until I’ve written it and can see which parts do what – what lends itself to extraction into subroutines, whether some functions can be inlined, etc. In a way, I let the code suggest its distribution of responsibilities to me. Perl just lets me be as sloppy as I deem fit. Python doesn’t trust that I’ll be disciplined when it counts.

That’s a general trend which extends to a lot of other details. In expressive power and conciseness, the languages are neck to neck, but writing Python feels like work.

Makeshifts last the longest.