Misuse of <tab>

John Roth newsgroups at jhrothjr.com
Wed Jul 30 13:16:58 EDT 2003


"Gisle Vanem" <giva at users.sourceforge.net> wrote in message
news:3f27f0e3$1 at news.broadpark.no...
> I'm a .py newbie and fascinated by the simplicity of formatting.
> No need for {} as in Perl etc. But the misuse of <tab> that many
> .py writers do makes it hard to understand how a script operates.
>
> E.g.
>
> def main():
>    terminate = 0
>    def foo():
>        line = sys.stdin.readline()
> <tab>  try:
>         bar()
>     except:
>         terminate = 1
>
> main()
>
> Now, with an editor with different tab-settings it's difficult to see
where
> the try statement belongs. In 'def main()' or in 'def foo()' ?
> I'm confused, please enlighten me.

You're quite right - mixing spaces and tabs when indenting is
not the thing to do. In fact, it's warned against in a number of
places. The recommended practice is to use spaces, and
avoid tabs completely.

I think you'll find that all the modules in the standard library
use spaces exclusively.

John Roth
>
> --gv
>
>






More information about the Python-list mailing list