Saturday, April 19, 2008

Python definitely beats them all

Whoa, I tried to write some Python code today (trying that nice Google App Engine, of course.)

Guess what... After three typed lines I managed to hit the first wall of laughability. My code does not compile (oh you may want to say "parse", I don't care) and that was because...

because some "unexpected indentation".

Indeed... there were blank lines at the end of the file, and those blank lines were actually not blank, but full of spaces. How do you distinguish an empty line from a line with only spaces? The funny thing is ... you don't :-)

The sad thing is that some people still believe that Python is a valid programming language :-(

3 comments:

Anonymous said...

How does your story support your claim that Python is not a valid programming language?

Stephan Leclercq said...

Instead, tell me how someone ever envisioned that using invisible characters as a major feature of a language was a viable idea.

Oh, not all invisible characters! that would be too simple! Exact behaviour of Form feed is undefined, the non breaking space is not supported, etc.

This leads to subtle bugs in the parsing. Bugs like the one I ran into. I suspect (but did not investigate further) that happened because the last line was not terminated by an end-of-line - gee, another invisible character that is required for the system to work .-)

Just because at first using indentation seemed a cool idea does not mean that it is a good idea. Python code cannot be reliably sent as text over e-mail, posted to a blog, etc. since you are never sure the transport agents will not remove the whitespace.

When it was done in COBOL, it was a bad idea. Today, it is still a bad idea.

Anonymous said...

Interesting to know.