Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it superfluous to declare # -*- coding: utf-8 -*- after #!/usr/bin/python3? [duplicate]

Tags:

python

utf-8

I have been writing:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

But I believe Python3 uses Unicode by default.

like image 207
zadrozny Avatar asked Jul 20 '16 23:07

zadrozny


People also ask

What are some examples of superfluous?

The definition of superfluous is something that is more than needed or unnecessary. An example of superfluous is a buying a stuffed animal for a child who already has too many stuffed animals. In excess of what is required or sufficient. With a full rain suit, carrying an umbrella may be superfluous.

What is the meaning of word superfluous?

superfluous • \soo-PER-floo-us\ • adjective. 1 : exceeding what is sufficient or necessary : extra 2 : not needed : unnecessary.

What is a superfluous statement?

Superfluous statements means the statements which are not really required for the program. You can rectify these statements by transaction SLIN. go to SLIN, give your prog name and tick 'Superflous Statements'. and execute. It will list all such statements with corrective measuers.


1 Answers

The default encoding for python3 code is utf-8. See python's unicode support.

If you want to support python2.x in the same file or if you want to use a coding other than utf-8, you need that comment, otherwise you can leave it off without any repercussions.

like image 175
mgilson Avatar answered Oct 11 '22 11:10

mgilson