Non-Indented python

Peter Hansen peter at engcorp.com
Wed Nov 21 06:02:33 CET 2001


(Accidentally sent, and I believe cancelled, partially written version... 
dang strange how Ctrl-Enter can be hit accidentally! :-(  )

Michael Kelly wrote:
> 
> I've been checking out Python and already there are many things
> I like about it, but I'm starting to get paranoid about indentation
> issues with code pasted out of other scripts.  Seems when the
> parser takes it into its head that "expecting indented block
> at line #" when it sure as hell looks indented, it gets into a
> thing where there's no way other than retyping lots of stuff
> and praying to get it to parse the code.
> 
> Is there a utility to "clean" foreign scripts so that tabs/spaces
> issues and other stuff invisible to the programmer can be
> weeded out?  

There's any detabbing utility on the planet, or the Python
utility Tools/Scripts/pindent.py.  If you stop using tabs
it really won't be a problem.  A good editor should be 
able to do this properly (when properly configured)
without the slightest trouble.  Maybe you have an editor
which saves files with tabs representing only four spaces
instead of the correct eight?

> What do you guys use esp. when cutting and pasting
> snippets from other files etc.??

Never had a problem, since we've turned off all tabs
everywhere.

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list