POV-Ray : Newsgroups : povray.off-topic : All bow to the mighty Python : Re: All bow to the mighty Python Server Time
4 Sep 2024 13:17:26 EDT (-0400)
  Re: All bow to the mighty Python  
From: Invisible
Date: 21 Apr 2010 04:24:40
Message: <4bceb648$1@news.povray.org>
Warp wrote:

>   How does the Python interpreter/compiler even work with different types of
> whitespace? If, for example, one line as 4 spaces at the beginning and the
> next line has one tab character?

I don't know about Python. In Haskell, any file containing a single tab 
character is immediately rejected (since tabs don't have any 
standardised width). If you're coding in Haskell, you're just not 
allowed to use tabs *at all*.

>   Relying on the use of whitespace for actual syntax is idiotic (with the
> exception of separating tokens with at least one whitespace character,
> while not being important how many).

Actually it's pretty logical. You might argue that requiring the 
programmer to manually type a semicolon at the end of each line when 
it's obvious that each line is a seperate statement is illogical.

>   I'm not concerned about typos. I'm concerned about whitespaces being lost
> in transfer and different types of whitespace.

The only real problem with using whitespace is that it tends to get 
mangled in emails, forum posts, etc. This isn't a problem when you're 
writing programs. This is *only* a problem if you try to post code 
snippets on forums and so forth. (And yes, it's kind of irritating.)

>   You seem to assume that statements never get longer than a certain length,
> so that they will all nicely fit in one line. Sometimes it's useful to be
> able to split statements into several lines.

I have no idea how Python works. What I do know is that Haskell is quite 
sensible about this. If you have, say, an if/then/else expression, you 
can write it all on one line, or on three seperate lines, or maybe on 
even more lines than that. Hell, if you want to, you can write an entire 
Haskell program on one line; whitespace is *optional*, and you can use 
it the way you want to use it, provided that a few simple rules are 
followed. It's really not that difficult.

>>>   Also autoindentation of Python code is a physical impossibility.

Depends. I don't know Python's syntax rules. Haskell uses whitespace, 
and it should be possible to autoindent it. (I'm not aware of any editor 
which does it, but then I'm not aware of any editor which knows what the 
hell Haskell is...)

>>         Why would this be a concern?
> 
>   Because when your editor can autoindent your code, it makes programming
> enormously easier (similarly to how syntax highlighting does).

And to think that I do all my programming with an editor which doesn't 
give me syntax hilighting *or* automatic indentation...

(Then again, I've yet to see an editor with auto-indent which actually 
indents stuff the way that *I* want it to, rather than the way the guy 
who wrote the editor wants it to.)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.