[issue13185] Why does Python interpreter care about curvy quotes in comments?
Phillip M. Feldman phillip.m.feld...@gmail.com added the comment: I'm beginning to understand the reasoning. This is quite a bit more complex than I initially thought, and I appreciate the explanations. Phillip On Sun, Oct 16, 2011 at 10:53 PM, Raymond Hettinger rep...@bugs.python.orgwrote: Raymond Hettinger raymond.hettin...@gmail.com added the comment: I concur with Martin and Ezio. This report was correctly closed as invalid. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
Phillip M. Feldman phillip.m.feld...@gmail.com added the comment: Hello Martin, This is a fine example of the so-called is-ought controversy. The error message is indeed telling me exactly what the problem is, but the underlying problem is that this scheme was poorly thought out. 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 comments. Phillip On Sat, Oct 15, 2011 at 4:26 AM, Martin v. Löwis rep...@bugs.python.orgwrote: Martin v. Löwis mar...@v.loewis.de added the comment: The error message told you exactly what the problem is. Your source file does not conform to PEP 263. The PEP also explains why this applies to comments as well: because the entire file gets decoded according to the source encoding, and parsing (including determining what comments are) only starts afterwards. Closing the report as invalid. -- nosy: +loewis resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ -- nosy: +phillip.m.feld...@gmail.com ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
Ezio Melotti ezio.melo...@gmail.com added the comment: In theory, with some encodings you can't even know where the line (and the comment) ends if you don't decode first. Also it doesn't seem worth to me changing the way files are parsed just for this use case. Assuming you are using UTF-8 (and you should), you shouldn't have any problem with Python 3, since it opens files using UTF-8 by default. It's anyway always better to be specific about the encoding you are using. -- nosy: +ezio.melotti stage: - committed/rejected type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
Martin v. Löwis mar...@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 comments. 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. Regards, Martin -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
Raymond Hettinger raymond.hettin...@gmail.com added the comment: I concur with Martin and Ezio. This report was correctly closed as invalid. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
Martin v. Löwis mar...@v.loewis.de added the comment: The error message told you exactly what the problem is. Your source file does not conform to PEP 263. The PEP also explains why this applies to comments as well: because the entire file gets decoded according to the source encoding, and parsing (including determining what comments are) only starts afterwards. Closing the report as invalid. -- nosy: +loewis resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
New submission from Phillip Feldman phillip.m.feld...@gmail.com: When I try to run a Python script that contains curvy quotes inside comments, the interpreter gets upset: SyntaxError: Non-ASCII character '\x92' in file ... on line 20198, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details Given that the quotes are appearing only in comments, why does the interpreter care about them? Why should it be doing anything at all with comments other than stripping them off? -- messages: 145583 nosy: Phillip.M.Feldman priority: normal severity: normal status: open title: Why does Python interpreter care about curvy quotes in comments? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13185] Why does Python interpreter care about curvy quotes in comments?
Changes by Phillip Feldman phillip.m.feld...@gmail.com: -- versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com