[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Irit Katriel


Change by Irit Katriel :


--
versions:  -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Malcolm Smith


Change by Malcolm Smith :


--
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Malcolm Smith


Malcolm Smith  added the comment:

I think it's unlikely that anyone is depending on the ability to enter blank 
lines in a "try" block in an InteractiveConsole, especially when blank lines 
terminate the input in almost every other context.

Conversely, everyone who's ever entered a multi-line statement into a Python 
console knows that blank lines usually terminate the input. And they may have 
gotten into the habit, as I did, of using a blank line to abandon an incomplete 
input, and they'll be surprised if it doesn't work in this context. 

On further experimentation, this also affects "def" statements, but only when 
the blank line is at the start of the block, causing the statement to be 
syntactically incomplete.

Native interpreter:

>>> def f():
...
  File "", line 2

^
IndentationError: expected an indented block after function definition on 
line 1

InteractiveConsole:

>>> def f():
...
...
...   pass
...
>>>

So I think the current behavior is likely to annoy a much larger number of 
people, but whoever's responsible for this part of the standard library will 
have to judge that for themselves.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Irit Katriel


Irit Katriel  added the comment:

> any difference in behavior is potentially annoying and could throw off 
> somebody's flow. So I think the InteractiveConsole should be changed to match 
> the native interpreter.


That would make InteractiveConsole more restrictive and break code that is 
currently working. It could also be annoying and throw off somebody's flow.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Malcolm Smith


Malcolm Smith  added the comment:

I agree that both behaviors are reasonable. However, the InteractiveConsole 
documentation says it should "closely emulate the behavior of the interactive 
Python interpreter". Since people are familiar with the native interpreter, any 
difference in behavior is potentially annoying and could throw off somebody's 
flow. So I think the InteractiveConsole should be changed to match the native 
interpreter.

Like the native interpreter, InteractiveConsole allows other multi-line blocks 
to be terminated with a blank line:

>>> def foo(x):
...   pass
...
>>> for x in [1,2,3]:
...   pass
...
>>>


I guess the reason why "try" is different is that a "try" block isn't a 
complete statement on its own. If you follow it with an "except" block, then 
that can indeed be terminated with a blank line.

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-11-30 Thread Irit Katriel


Irit Katriel  added the comment:

I'm pretty sure both behaviours are by design.  Can you explain why this is a 
problem?

--
nosy: +iritkatriel
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2017-08-13 Thread Tom Viner

Changes by Tom Viner :


--
nosy: +tomviner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2017-08-13 Thread Malcolm Smith

New submission from Malcolm Smith:

The standard interpreter is more eager to give an error on incomplete input, 
while the InteractiveConsole will keep on prompting for more:

Python 3.5.3 (default, Apr 10 2017, 07:53:16)  [GCC 6.3.0 64 bit (AMD64)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
...
  File "", line 2

^
IndentationError: expected an indented block
>>> import code
>>> code.interact()
Python 3.5.3 (default, Apr 10 2017, 07:53:16)  [GCC 6.3.0 64 bit (AMD64)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> try:
...
...
...
...

The InteractiveConsole isn't totally wrong here, because after all, a blank 
line in this position is syntactically correct. But the inconsistency is 
confusing.

--
components: Library (Lib)
messages: 300230
nosy: Malcolm Smith
priority: normal
severity: normal
status: open
title: Blank line inconsistency between InteractiveConsole and standard 
interpreter
type: behavior
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com