Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unintended output
#2
Check out this example of code with a similar issue
>>> t = [[None] *2] *5
>>> t
[[None, None], [None, None], [None, None], [None, None], [None, None]]
>>> t[0][0] = 1
>>> t
[[1, None], [1, None], [1, None], [1, None], [1, None]]
Reply


Messages In This Thread
Unintended output - by Nick_Wright - Dec-05-2016, 09:24 PM
RE: Unintended output - by micseydel - Dec-05-2016, 09:29 PM

Forum Jump:

User Panel Messages

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