[issue37134] Use PEP570 syntax in the documentation
Grant Jenks added the comment: Pablo, I never intended disrespect toward you personally. And I am sorry my words came across that way. I would rather the feature be one of Python's more esoteric qualities. I think Carol has described the most reasonable way forward. And in particular, I like this creative idea: > A Sphinx extension may also be made to show a simple user-friendly view and > with a click the fully accurate view. I agree too with Raymond in this point: > I don't think inclusion in 3.9 should be automatic. As anecdata: I showed the PEP and feature to an intermediate class of 15 professional software engineers today. The first question I got was, "when should I use that in my Python code?" And I think the answer is rarely. We reviewed the motivating cases in the PEP and those made sense to them. But I was left feeling concern that if it were prominent and frequent in the docs then people will be likely to imitate, not least of which through simple copy/paste, what they see there without understanding the C-API and why it is that way. -- ___ Python tracker <https://bugs.python.org/issue37134> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37134] [EASY] Use PEP570 syntax in the documentation
Grant Jenks added the comment: FWIW, I would rather not see the docs littered with "/". I've taught Python to hundreds of professional software engineers over the last five years and in all that time nobody has ever asked when the args need to be positional. It's easy to experiment to find out and it's historically been an implementation detail. I think the number of times people are surprised is far less than the number of times people never notice at all. As Raymond described, this change will elevate the feature to a day-1 topic and it's pretty useless to a day-1 user. This is another step toward making what I see as an unfortunate implementation detail into formal semantics. -- nosy: +grantjenks ___ Python tracker <https://bugs.python.org/issue37134> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34055] IDLE: erroneous 'smart' indents in shell
Grant Jenks added the comment: This issue was closed but I still see the problem in 3.7.2. Here's a snippet with line numbers from IDLE: 01 Python 3.7.2 (default, Dec 30 2018, 08:59:00) 02 [Clang 9.1.0 (clang-902.0.39.2)] on darwin 03 Type "help", "copyright", "credits" or "license()" for more information. 04 >>> 1 + 2 05 3 06 >>> print('Hello') 07 Hello 08 >>> d = {1: 'uno', 2: 'dos', 3: 'tres} 09 10 SyntaxError: EOL while scanning string literal 11 >>> 1 + 2 12 13 3 14 >>> Notice that IDLE is inserting an extra blank line at (12) above. And here's a snippet with line numbers from the Python shell: 01 Python 3.7.2 (default, Dec 30 2018, 08:59:00) 02 [Clang 9.1.0 (clang-902.0.39.2)] on darwin 03 Type "help", "copyright", "credits" or "license" for more information. 04 >>> 1 + 2 05 3 06 >>> print('Hello') 07 Hello 08 >>> d = {1: 'uno', 2: 'dos', 3: 'tres} 09 File "", line 1 10 d = {1: 'uno', 2: 'dos', 3: 'tres} 11 ^ 12 SyntaxError: EOL while scanning string literal 13 >>> 1 + 2 14 3 15 >>> Between lines (13) and (14) there is no extra blank line. I'm sorry if my initial post was unclear. But the extra blank line is the bug I'm describing. I don't think there should be an extra blank line between (11) and (13) in the IDLE shell. This blank line persists for every input, even after restarts. I'm on macOS. I would be interested in debugging the issue locally but I ran into a couple issues trying to do so. When I check out the CPython sources and build the python.exe executable, I get this error when trying to execute IDLE: $ ./python.exe -m pdb -m idlelib.idle > /Users/grantj/repos/cpython/Lib/idlelib/idle.py(1)() -> import os.path (Pdb) c Traceback (most recent call last): File "/Users/grantj/repos/cpython/Lib/pdb.py", line 1695, in main pdb._runmodule(mainpyfile) File "/Users/grantj/repos/cpython/Lib/pdb.py", line 1540, in _runmodule self.run(code) File "/Users/grantj/repos/cpython/Lib/bdb.py", line 585, in run exec(cmd, globals, locals) File "/Users/grantj/repos/cpython/Lib/idlelib/idle.py", line 1, in import os.path File "/Users/grantj/repos/cpython/Lib/idlelib/pyshell.py", line 1507, in main macosx.setupApp(root, flist) File "/Users/grantj/repos/cpython/Lib/idlelib/macosx.py", line 280, in setupApp overrideRootMenu(root, flist) File "/Users/grantj/repos/cpython/Lib/idlelib/macosx.py", line 181, in overrideRootMenu del mainmenu.menudefs[-2][1][0] IndexError: list assignment index out of range If I comment out line 181 in /Users/grantj/repos/cpython/Lib/idlelib/macosx.py then I can get IDLE to start. But it will later crash trying to display the first tooltip: $ ./python.exe -m pdb -m idlelib.idle > /Users/grantj/repos/cpython/Lib/idlelib/idle.py(1)() -> import os.path (Pdb) c 2019-01-02 15:52:57.582 python.exe[23803:6374992] *** Assertion failure in -[_NSCGSWindow setFrame:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.60.100/CGS.subproj/NSCGSWindow.m:1002 2019-01-02 15:52:57.588 python.exe[23803:6374992] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: CGRectContainsRect(CGRectMake((CGFloat)INT_MIN, (CGFloat)INT_MIN, (CGFloat)INT_MAX - (CGFloat)INT_MIN, (CGFloat)INT_MAX - (CGFloat)INT_MIN), frame)' *** First throw call stack: ( 0 CoreFoundation 0x7fff48fa923b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x7fff7023ac76 objc_exception_throw + 48 2 CoreFoundation 0x7fff48faefd2 +[NSException raise:format:arguments:] + 98 3 Foundation 0x7fff4b0d9150 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 AppKit 0x7fff465d6f50 -[_NSCGSWindow setFrame:] + 475 5 AppKit 0x7fff4668eb07 _NSCreateWindowWithOpaqueShape2 + 248 6 AppKit 0x7fff4668d763 -[NSWindow _commonAwake] + 1057 7 AppKit 0x7fff46d9bbe7 -[NSWindow(NSWindow_Carbon) windowRefWithCompositedAttribute:andFrameworkScaledAttribute:] + 139 8 Tk 0x0001061f9ad5 XMapWindow + 239 9 Tk 0x000106166dbf Tk_MapWindow + 89 10 Tk 0x
[issue35196] IDLE text squeezer is too aggressive and is slow
Change by Grant Jenks : -- nosy: +grantjenks ___ Python tracker <https://bugs.python.org/issue35196> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34549] unittest docs could use another header
Change by Grant Jenks : -- nosy: +grantjenks ___ Python tracker <https://bugs.python.org/issue34549> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34445] asyncio support in doctests
Grant Jenks added the comment: This is not a bug in Python. The SyntaxError matches expected behavior. According to the Python grammar, you can't have "await" outside of a function. You have "await" at the globals scope which is not permitted. You may only "await" functions from within other functions. Doctest is designed to emulate what you would type into the Python shell. Your doctest snippet does not work there either: ``` $ python3 Python 3.7.0 (default, Jun 28 2018, 05:55:06) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> async def hello_world(): ... return "Hello, world!" ... >>> await hello_world() File "", line 1 SyntaxError: 'await' outside function ``` To make your doctests work, use ``asyncio.run`` like so: ``` import asyncio async def hello_world(): """ Will greet the world with a friendly hello. >>> asyncio.run(hello_world()) 'hello world' """ return "hello world" if __name__ == "__main__": import doctest doctest.testmod() ``` Stefan, you may get a quicker answer next time from a forum like StackOverflow. Yury, it's probably a good idea to cover this case in your upcoming asyncio docs improvements. -- nosy: +grantjenks ___ Python tracker <https://bugs.python.org/issue34445> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14841] os.get_terminal_size() should check stdin as a fallback
Grant Jenks added the comment: I asked on the ncurses maintainers email list about their logic and was pointed to tty_settings.c which checks: 1. stderr 2. stdout 3. stdin 4. open('/dev/tty', 'r+') I don't know a cross-platform way to check #4 but I think #1-3 are a reasonable change to shutil.get_terminal_size(). The current logic checks only stdout. I'd like to amend that to try stderr, stdout, and stdin after checking the COLUMNS and LINES env vars. So the new logic would be: 1. Check COLUMNS and LINES env vars (for overrides) 2. Check os.get_terminal_size(stderr) 3. Check os.get_terminal_size(stdout) 4. Check os.get_terminal_size(stdin) -- nosy: +grantjenks versions: +Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue14841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34055] IDLE inserts extra blank line in prompt after SyntaxError
New submission from Grant Jenks : IDLE inserts an extra blank line after the prompt after encountering a SyntaxError: ``` >>> 1 + 2 3 >>> print('Hello') Hello v-- Missing single quote! >>> d = {1: 'uno', 2: 'dos', 3: 'tres} SyntaxError: EOL while scanning string literal >>> print('Hello') <-- Extra blank line and whitespace (tab and space). Hello >>> 1 + 2 <-- Extra blank line and whitespace (tab and space). 3 >>> ``` Notice the line starting with ">>> d =" above contains a missing single quote which causes a "SyntaxError: EOL while scanning string literal". This causes IDLE to insert extra blank lines with one tab and one space after every input. The old behavior looked like: ``` >>> 1 + 2 3 >>> print('Hello') Hello >>> d = {1: 'uno', 2: 'dos', 3: 'tres} SyntaxError: EOL while scanning string literal >>> print('Hello') Hello >>> 1 + 2 3 ``` -- assignee: terry.reedy components: IDLE messages: 321126 nosy: grantjenks, terry.reedy priority: normal severity: normal status: open title: IDLE inserts extra blank line in prompt after SyntaxError type: behavior versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue34055> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23666] Add shell session logging option to IDLE
Grant Jenks added the comment: +1 from me. I'd like to see it ask me to save when I close the window if I've already saved once. -- nosy: +grantjenks ___ Python tracker <https://bugs.python.org/issue23666> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com