python - If your source is ASCII, should you specify coding? -


we have large project entirely coded in ascii. worth putting coding statements @ beginning of each source file (e.g. #coding=utf-8) reason if source doesn't have unicode in it?

thanks, --peter

ascii default in python 2. utf-8 default in python 3.

if files ascii-only; don't need declare source code encoding in both version (ascii subset of utf-8).

non-ascii character leads syntaxerror in python 2 therefore accidental non-ascii character won't go unnoticed , won't corrupt data. there no reason declare source code encoding ascii-only files.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -