Proper shebang for python3

Manfred Lotz ml_news at posteo.de
Sat Jul 20 13:53:18 EDT 2019


On Sun, 21 Jul 2019 03:44:24 +1000
Chris Angelico <rosuav at gmail.com> wrote:

> On Sun, Jul 21, 2019 at 3:41 AM Manfred Lotz <ml_news at posteo.de>
> wrote:
> >
> > Hi there,
> > Pretty new to python I've got a question regarding the proper
> > shebang for Python 3.
> >
> > I use
> >    #!/usr/bin/python3
> >
> > which works fine.
> >
> > Today I saw
> >    #!/usr/bin/python3 -tt
> >
> > and was wondering what -tt means.
> >
> > Being on Fedora 30, Python 3.7.3 the man page of python3 doesn't
> > even mention -t.
> >
> > python 2 man page mentions
> >
> >        -t     Issue a warning when a source file mixes tabs and
> > spaces for indentation in a way that makes  it  depend  on  the
> > worth of a tab expressed in spaces.  Issue an error when the option
> > is given twice.
> >
> > I guess that -t has the same meaning with python 3.7.3.  
> 
> Far as I know, the -tt option to Python 3 is accepted for 2/3
> compatibility, but does absolutely nothing. Having it on the shebang
> probably means that it used to be /usr/bin/python -tt, and got
> migrated to python3 without removing it.
> 

This is a plausible explanation.

Thanks, Manfred







More information about the Python-list mailing list