On 3/16/2016 3:14 AM, Serhiy Storchaka wrote: > On 16.03.16 02:28, Guido van Rossum wrote: >> I agree that the spirit of the PEP is to stop at the first coding >> cookie found. Would it be okay if I updated the PEP to clarify this? >> I'll definitely also update the docs. > > Could you please also update the regular expression in PEP 263 to > "^[ \t\v]*#.*?coding[:=][ \t]*([-.a-zA-Z0-9]+)"? > > Coding cookie must be in comment, only the first occurrence in the line > must be taken to account (here is a bug in CPython), encoding name must > be ASCII, and there must not be any Python statement on the line that > contains the encoding declaration. [1] > > [1] https://bugs.python.org/issue18873 Also, I think there should be one 'official' function somewhere in the stdlib to get and return the encoding declaration. The patch for the issue above had to make the same change in four places other than tests, a violent violation of DRY. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4