[docs] [issue24531] please document that no code preceding encoding declaration is allowed

Jakub Wilk report at bugs.python.org
Mon Jun 29 17:42:25 CEST 2015


New submission from Jakub Wilk:

If the encoding is declared on the second line, the first line must not contain anything except comments. However, this fact is not documented.

The Python Language reference says only that "the encoding declaration must appear on a line of its own";
and PEP 263 says only that "there must not be any Python statement on the line that contains the encoding declaration".

For example, Python ignores this encoding declaration:

spam = True
# encoding=ISO-8859-2

despite the fact that it appears on a line of its own.

----------
assignee: docs at python
components: Documentation
messages: 245946
nosy: docs at python, jwilk
priority: normal
severity: normal
status: open
title: please document that no code preceding encoding declaration is allowed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24531>
_______________________________________


More information about the docs mailing list