On 17.11.15 18:50, Guido van Rossum wrote: > On Tue, Nov 17, 2015 at 8:20 AM, Serhiy Storchaka <storchaka at gmail.com> wrote: >> Current implementation of import system went the same way. As a result >> importing the script as a module and running it with command line can have >> different behaviours in corner cases. > > I'm confused. *Of course* these two behaviors differ, since Python > uses a different __name__. Not sure how this relates to the REPL. Sorry for confusing. I meant parser level. File parser has a few bugs, that can cause that the source will be differently interpreted with file and string parsers. For example attached script produces different output, "ä" if executed as a script, and "À" if imported as a module. And there is a question about the null byte. Now compile(), exec(), eval() raises an exception if the script contains the null byte. Formerly they accepted it, but the null byte ended the script. The behavior of file parser is more weird. The null byte makes parser to ignore the end of script including the newline byte [1]. E.g. "#\0\nprint('a')" is interpreted as "#print('a')". This is different from PyPy (and may be other implementations) that interprets the null byte just as ordinal character. The question is wherever we should support the null byte in Python sources. [1] http://bugs.python.org/issue20115 -------------- next part -------------- A non-text attachment was scrubbed... Name: long_first_coding_line.py Type: text/x-python Size: 8223 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20151119/4616fb00/attachment.py>
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