is there a whitespace-free python convention?

John Roth johnroth at ameritech.net
Sat Feb 8 20:20:40 EST 2003


<eichin at metacarta.com> wrote in message
news:7ghebf5l2j.fsf at pikespeak.metacarta.com...
> I stumbled across this problem with posting code snippets to a
> sourceforge discussion -- basically, there's no whitespace
> preservation, though newlines are preserved [or it wouldn't even be
> worth trying], so even simple code gets mangled.
>
> Arguably, the fix is for sourceforge to support some mechansim for not
> losing whitespace (perhaps html tags, but <pre> clearly didn't work.)

I'd agree that sourceforge discussions are broken. However, so is
Outlook Express, Yahoo Groups and several other venues that
unilaterally
discard white space at the beginning of lines. Some of them are actually
more or less bizzare: Outlook Express discards tabs but accepts spaces,
Yahoo Groups discards spaces as well - but then puts them back
if you try to reply to the message. Wierd! The thing is, these
are not specifically Python problems. It affects readability of any
programming language snippet where indentation is required to make
it readable, even if it does not affect parsability.

There's a more painful problem with embedding Python inside
of HTML as a script language.

> However, a related case came to mind -- a friend of mine does all of
> his coding with emacspeak, and while he can switch it to 'explicit
> whitespace' mode, it is kind of painful.
>
> So, working from both sides, is there a convention that people
> actually like for expressing indentation when it isn't really there?

The problem with Outlook Express is using tabs instead of spaces.
I believe the problem with Yahoo Groups is the lack of a character
at the beginning of a line - it seems to handle spaces after a leading
character just fine, although I should test this before sounding
certain.
I don't know what the problem is with Sourceforge, but a little
experimentation might show something. Replacing the spaces with
  might do something.

John Roth






More information about the Python-list mailing list