OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Valid encodings for a Python source file


I'm trying to figure out the entire list of possible encodings for a Python
source file - that is, encodings that can go in a PEP 263
<https://www.python.org/dev/peps/pep-0263/> encoding specification, like #
-*- encoding: foo -*-.

Is this list the same as the list given in the documentation for the codecs
library, under "Standard Encodings"
<https://docs.python.org/3.6/library/codecs.html#standard-encodings>? If
not, where can I find the actual list?

(I know that list is the same as the set of unique values in CPython's
/Lib/encodings/aliases.py
<https://github.com/python/cpython/blob/master/Lib/encodings/aliases.py>,
or equivalently, the set of filenames in /Lib/encodings/
<https://github.com/python/cpython/blob/master/Lib/encodings/>, but again
I'm not sure.)
-Daniel