Is it new style or just lack of style?

Danyel Fisher danyelf at ics.uci.edu
Fri Aug 3 03:49:47 EDT 2001


> More and more I am starting to see people adding extra
> blanks in ( ).

> Is it new style?  I am sure this contradicts Python Style
> Guide, but where from this new style appeared? I saw Java programs
> with the same ugly padding...

Indeed. It Greatly Displeases our BDFL. Despite that, it is an old
and well-loved style, a favorite from many languages... Because I
am carefully putting off real work, I have saved you the effort of a
solid web search.

In my Java class, lo those many years ago, we learned that we want
spaces in that open style: foo( bar )
http://www.alumni.caltech.edu/~croft/research/java/guide/#format
http://www.javaranch.com/style.jsp#space
    (which is nice enough to point out that this is a hybrid of practicality
of the way that many text editors implement double-click-for-copy, and
tradition)

Many others disagree.
http://java.sun.com/docs/codeconv/html/CodeConventions.doc7.html#475
http://www.geosoft.no/javastyle.html#White%20Space
[Note that the JavaSoft guide wants you to space things as
    foo( bar );
while the GeoSoft guide prefers
    foo(bar);
]

------------------
I don't know what the history is. I tried a few other languages, looking
for "<language> style guide whitespace" on Google...

Most languages dislike it...

Perl doesn't care too much. Apparently, there's more than one way to do it.
http://www.javaranch.com/style.jsp#space

C:
http://www.apocalypse.org/pub/u/paul/docs/cstyle/cstyle06.htm

Lisp:
http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/faqs/lang
/lisp/part1/faq-doc-4.html

Fortran:
http://www.aeem.iastate.edu/Computers/Software/Fortran/guide.html

Ada:
http://www.grammatech.com/aadoc/man-whitespace.html#horizontalWhitespace

And then some breakthroughs...

Assembly:
http://webster.cs.ucr.edu/Page_asm/moreasm/asmstyle.htm
mentions things like
     mov ax, 10;  { Set AX to 11 }
;                       swap( a[i][j], b[j][i] );
in comments.

http://www.students.stedwards.edu/~ttiriti/pl.htm
suggests
    awk -F: '{ print $1; print $2; print $3 }' /etc/passwd
which is a habit I certainly find myself falling into when
I'm hacking shell scripts--it keeps everything apart, and
therefore VERY VERY clear to the interpreter.

Does anyone have a better sense of history on this?

--Danyel





More information about the Python-list mailing list