Python Forum
What is the reason for this difference between lists and tuples?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the reason for this difference between lists and tuples?
#1
I am a Python beginner, and recently I discovered a key difference between lists and tuples.

If I write something like:

list1 = list1.append(list2)
...then list1 becomes a "NoneType" object. In other words if you pass an appended list to its own name, then it is replaced with a NoneType object.

This isn't the case with tuples though...is there a reason for this?
Reply


Messages In This Thread
What is the reason for this difference between lists and tuples? - by Athenaeum - Sep-25-2017, 08:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  coma separator is printed on a new line for some reason tester_V 4 623 Feb-02-2024, 06:06 PM
Last Post: tester_V
  Output difference from 2 lists of different sizes with words gracenz 5 1,436 Sep-02-2022, 05:09 PM
Last Post: Larz60+
  Split dict of lists into smaller dicts of lists. pcs3rd 3 2,524 Sep-19-2020, 09:12 AM
Last Post: ibreeden
  Reason of the output himanshub7 2 2,248 Apr-28-2020, 10:44 AM
Last Post: TomToad
  Code used to work, not anymore for no apparent reason? chicagoxjl 1 1,959 Jan-08-2020, 05:05 PM
Last Post: jefsummers
  Syntax error for a reason I don't understand DanielCook 2 2,495 Aug-07-2019, 11:49 AM
Last Post: buran
  sort lists of lists with multiple criteria: similar values need to be treated equal stillsen 2 3,411 Mar-20-2019, 08:01 PM
Last Post: stillsen
  "invalid syntax" for no apparent reason wardancer84 2 7,238 Oct-03-2018, 11:57 AM
Last Post: wardancer84
  for some reason this isnt working lokchi2017 3 2,772 Aug-06-2018, 12:24 PM
Last Post: perfringo
  My program subtracts fractions, but for some reason isn't simplifying them RedSkeleton007 9 6,075 Mar-03-2018, 11:45 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