Python Forum
I can't understand this problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't understand this problem
#5
(Dec-23-2018, 09:17 PM)muhammedkhairy Wrote: it is the same but I use here Append which mutate the original list but also inside the function, So why here I see the mutated list not the original

It's not the same. When you append, you modify the original list. As stulis notes, mylist is pointing to the location of list2. In your original code, you created a new list by adding two lists together. This does not modify the original list. In that code, my_list was pointing to the location of list2, but then you reassign it (with the = assignment operator) to the location of the new list you just created by adding.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
I can't understand this problem - by muhammedkhairy - Dec-23-2018, 07:37 PM
RE: I can't understand this problem - by ichabod801 - Dec-23-2018, 08:36 PM
RE: I can't understand this problem - by stullis - Dec-23-2018, 09:35 PM
RE: I can't understand this problem - by ichabod801 - Dec-23-2018, 09:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Couldn't really understand the problem Batselot 1 2,313 Dec-13-2018, 07:59 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020