This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iuliananet
Recipients iuliananet
Date 2018-11-15.13:30:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542288601.52.0.788709270274.issue35256@psf.upfronthosting.co.za>
In-reply-to
Content
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']
History
Date User Action Args
2018-11-15 13:30:01iuliananetsetrecipients: + iuliananet
2018-11-15 13:30:01iuliananetsetmessageid: <1542288601.52.0.788709270274.issue35256@psf.upfronthosting.co.za>
2018-11-15 13:30:01iuliananetlinkissue35256 messages
2018-11-15 13:30:01iuliananetcreate