Ian Bicking: the old part of his blog

The UnZen of UnPython

Chris McDonough is thinking about what Unpythonic means, and he kind of concludes that it's just a stick to beat other people over the head with, that like "obscenity" it's just a vague term brought out to invoke a response without being very explicit about what really bothers you.

Probably true. But then, I think "Unpythonic" really does mean something. So I thought I'd invert the Zen of Python (import this).

The UnZen of UnPython

An inverted version of the original by Tim Peters


It's the UnZen because I also destroy any Zenness when I explain each item. No elegant koans here. And I left out the Dutch one; I didn't feel like picking on some arbitrarily chosen nationality.

But for just about each idea, it seems like there's someone or some project that really does value the opposite idea. They seem to fall into two camps: the first several for cowboy coders and cowboy languages (*coughperlcough*), and the second half are ivory tower programmers and languages (*coughschemecough*). Inverting the error handling reminds me of this article. Complex syntax and special cases reminds me of people who defend Perl as a Huffman coding of programmer intent. Just to name a few.

Anyway, food for thought.

Created 09 Nov '05
Modified 09 Nov '05

Comments:

This is great :). I think I might have to go and retroactively remove my use of the word "pythonic" anywhere public, now...

Might I suggest a minor edit, though? Since most of these seem semi-serious (or at least, I've heard most of them proposed by "serious" people), the "namespaces" one seems out of place... how about:

Namespaces are a terrible idea, let's stop doing that because typing ``foo.bar`` takes twice as much time and energy to type as ``bar``

# Glyph Lefkowitz

Better indeed; applied!

# Ian Bicking

Would it be Pythonic to expect claims of "UnPythonic!" to be supported by a Pythonic rewrite? If the Pythonic rewrite were sufficiently Pythonic, any inflamatory claims accompanying the Pythonic rewrite could be ignored, or left out completely.

# pass

> import that

# Niko Klaric

Better yet: >>> export that ;o)

# Rod Senra

How wise... a bunch of a posteriori revisionists.

I would add: You can always write FORTRAN code in any language: Python is not inmune to that either.

# anonymous

Every Unpythonic idea can be done in Python, and I could probably come up with an example for each one too, but I'm not that into the exposition of bad code. I'm sure I've done several of them myself.

It would be pretty boring to talk about "Pythonic" and "Unpythonic" if it just mean "syntactically valid according to the Python interpreter" or "not valid".

# Ian Bicking