Another salvo in the indentation war? I hope not.

Lee Joramo ljoramo.list at nickads.com
Mon May 29 18:44:41 CEST 2000


>When a newsreader, browser, or mail program trashes the
>indentation from examples of Python source, it is a real pain in the
>hindlimbs to recover the original program logic.

I have seen this problem a fair amount. I think that others are slightly
misunderstanding your original point. You are talking about __Examples__ of
Python source code that are pasted into a message. Text can get mixed up
many ways. Tabs get lost in HTML conversions. Line breaks are inserted in
long lines. >'s are inserted at the start of lines to mark quotations
(which then lead to long line problems). Etc.

As a practical matter, we normally read around these types of problems. And
of course, when distributing the source of an entire program we use other
methods. Still, on occasion this can lead to great confusion.

A solution to this problem can be found in Userland software's Frontier.
<http://frontier.userland.com/>. For those unfamiliar with Frontier, it is
scripting system equivalent to Python and Zope plus an excellent
development environment. Frontier's scripting language philosophy is very
similar to Python in many respects including the use of indentation.

The point pertinent to our discussion, is that when you export scripts from
Frontier you may do so either as white space formatted or in a format
similar to C using curly braces and semi-colon's. This C style formatting
ensures that code is not broken due to the vagaries of various transmission
methods. Naturally, when you import C style text back into Frontier, it
converts back into white space formatted. Frontier users would never write
code directly in this C style format.

While this approach works very well, it would be hard to implement in
Python for several reasons.

* Frontier has had this feature since day one 10 years years ago, and it is
part of the program and culture. For Python, this would have to be added to
the interpreter and cause backward compatibility problems.
* Almost all Frontier code is written within the Frontier environment's
excellent outliner, so whitespace rules are strictly enforced. Python
programmers use many different external editors. If added to Python, I
could see many new users opting to code in the C-style format. (A BAD
THING).
* One of Python's objectives is to be easy to learn. I think that allowing
an alternate format will cause more confusion than it will clear up.
(Again, if Python, controlled the development environment the way Frontier
does, maybe something could be done, but that is not ever going to be the
case.)

--
Lee A. Joramo                      ljoramo at nickads.com
The Nickel Want Ads                www.nickads.com
Internet Manager                   970-242-5555





More information about the Python-list mailing list