Whitespace as syntax (was Re: Python Rocks!)

Mark Hammond mhammond at skippinet.com.au
Mon Feb 7 23:57:40 EST 2000


<fcahoon at my-deja.com> wrote in message
news:87o1br$ltq$1 at nnrp1.deja.com...
> In article <024201bf71cb$bfc6a670$01646464 at computer>,
>   "Neil Hodgson" <neilh at hare.net.au> wrote:

> >    I'd like to understand what 'mis-formatting' you are worried
about.
> > Either Python code is syntactically valid or it is not. If the
original
> > author has given you syntactically valid Python, then it has an
> > unambiguous structure and can be reformatted to use any
> > spacing / tabbing approach you wish to standardise on.
> This is what I've seen in some C code that's been through many
hands:
>
> The old-timers used 8-space tabs to effect 3-space indentation.
Don't
> ask me why.  The 2nd generation of coders set their tabs to 3 spaces
in
> the editor, editing some parts of the code, unaware that other parts
of
> the same file contained 8-space tabs.  Tabs were converted to spaces
> under the mistaken assumption that they were all 3-space tabs.

But Neil's point is that the C code remains syntactically valid
through that process, whereas the Python code may not.  If you have
working Python code, and the knowledge that 1 tab==8 spaces to the
parser, then it _is_ possible to reformat to either full tabs or no
tabs without any chance of the program changing functionally.

Mark.






More information about the Python-list mailing list