[issue13185] Why does Python interpreter care about curvy quotes in comments?
Martin v. Löwis
report at bugs.python.org
Mon Oct 17 07:41:44 CEST 2011
Martin v. Löwis <martin at v.loewis.de> added the comment:
Am 17.10.2011 06:22, schrieb Phillip Feldman:
> This is a fine example of the so-called "is-ought" controversy.
Wrong. This has nothing to do with desired and factual. A bug, by
definition, is a deviation from the specification. This is not a bug,
since it exactly follows the specification.
Now you may want to challenge the specification, which makes it a
feature request. However, given that the PEP was discussed in 2001,
you are about ten years late for that.
> underlying problem is that this scheme was poorly thought out.
I object this assessment. This very behavior was carefully considered
and deliberately chosen.
> Clearly, the stripping of comments and the source decoding should both be done in
> a single pass, and the source decoding should not be applied to the
That's not clear at all. In general (i.e. for arbitrary encodings), it
is not possible to determine where the hash ("#") signs are in the input
without decoding. So you have to decode first.
In addition, it was a deliberate choice that the source encoding must be
consistent (i.e. all characters in the source must decode correctly),
even if that is not needed for parsing. This is like requiring colons
at the end of statements: they are not needed for parsing, but requiring
them improves the language.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list