[issue41394] Behiavior of '_' strange in shell

2020-07-25 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This behaviour is documented at 
https://docs.python.org/3/library/sys.html#sys.displayhook.

--

___
Python tracker 

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



[issue41394] Behiavior of '_' strange in shell

2020-07-25 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi wyz23x2, did you do that from a clean interpreter?

_ is set to the last non-None result: 
https://github.com/python/cpython/blob/dd8a93e23b5c4f9290e1cea6183d97eb9b5e61c0/Python/sysmodule.c#L690-L696

So what you are seeing is that (None and True) is None, but _ is set to some 
value that you got from a previous input.

I think the component for this report is "Interpreter core".

--
components: +Interpreter Core
nosy: +remi.lapeyre

___
Python tracker 

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



[issue41394] Behiavior of '_' strange in shell

2020-07-25 Thread wyz23x2


New submission from wyz23x2 :

>>> (None and True)
>>> print(_)
False
>>> print((None and True))  # Not same?!
None
>>> 

This isn't right.

P.S. What component should this be? IDLE? It's the shell, not just IDLE. Core? 
Not that deep!

--
messages: 374260
nosy: wyz23x2
priority: normal
severity: normal
status: open
title: Behiavior of '_' strange in shell
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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