[New-bugs-announce] [issue35256] The Console of Python 3.7.0.

Iuliana Netoi report at bugs.python.org
Thu Nov 15 08:30:01 EST 2018


New submission from Iuliana Netoi <iuliana.netoi at yahoo.com>:

While running a function that uses a list to which I append the element "z", the Console modifies my code by adding "z" to the list each time I consequently run the function. 

Is that a bug?

My function written in the Editor of Python 3.7.0. is the following:

#%%
my_list = ["this","is","my","very","first","list"]
def problem2_2(my_list):
      my_list.append("z")
      print(my_list)  
    #%%

I click the "Run" icon in the Menu. Then I type problem2_2(my_list) in the CONSOLE.

At the first execution it is ok. 
But when executing right again, the console adds another element "z" to my list. And so on, for each next execution - as if the Console modifies my code. 

(Anyway when reverting to the Editor, click inside the cell, and then "Run" icon in the Menu, only after the first execution it is printed the right number of elements)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

There is the Console executions:

mmy_list = ["this","is","my","very","first","list"]
def problem2_2(my_list):
      my_list.append("z")
      print(my_list)

problem2_2(my_list)
['this', 'is', 'my', 'very', 'first', 'list', 'z']

problem2_2(my_list)
['this', 'is', 'my', 'very', 'first', 'list', 'z', 'z']

problem2_2(my_list)
['this', 'is', 'my', 'very', 'first', 'list', 'z', 'z', 'z']

problem2_2(my_list)
['this', 'is', 'my', 'very', 'first', 'list', 'z', 'z', 'z', 'z']

----------
components: Tests
messages: 329949
nosy: iuliananet
priority: normal
severity: normal
status: open
title: The Console of Python 3.7.0.
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35256>
_______________________________________


More information about the New-bugs-announce mailing list