About 95,200 results
Open links in new tab
  1. Python's Mutable vs Immutable Types: What's the Difference?

    Jan 26, 2025 · Python’s mutable objects, such as lists and dictionaries, allow you to change their value or data directly without affecting their identity. In contrast, immutable objects, like tuples …

  2. Mutable vs Immutable Objects in Python - GeeksforGeeks

    May 21, 2024 · We know that a tuple in Python is immutable. But the tuple consists of a sequence of names with unchangeable bindings to objects. Consider a tuple; tup = ([3, 4, 5], 'myname') …

  3. python - Why can tuples contain mutable items? - Stack Overflow

    Mar 13, 2021 · The tuple itself isn't mutable (i.e. it doesn't have any methods that for changing its contents). Likewise, the string is immutable because strings don't have any mutating methods. …

  4. Mutable tuples - Python Morsels

    Jun 28, 2021 · Tuples are immutable in Python, but tuples can contain mutable objects. So (strangely) if a tuple contains a mutable object, it's possible for the value of that tuple to change.

  5. Is Tuple Mutable or Immutable?

    Mar 13, 2023 · A: The main difference between a tuple and a list in Python is that a tuple is immutable, while a list is mutable. This means that once a tuple is created, its elements cannot …

  6. Python Tuples are Immutable, Except When They're Mutable

    Feb 5, 2018 · Are Tuples Mutable or Immutable? In Python, tuples are immutable, and "immutable" means the value cannot change. These are well-known, basic facts of Python. …

  7. Tuples :: Learn Python by Nina Zakharenko

    Tuples are light-weight collections used to keep track of related, but different items. Tuples are immutable, meaning that once a tuple has been created, the items in it can’t change. You …

  8. Python Tuple - An Immutable Sequence - AskPython

    Jul 19, 2019 · Python tuple is an immutable sequence. How to create a tuple, iterate over a tuple, convert list to a tuple, convert string to a tuple, Python Tuple vs List.

  9. Solved: How Can Tuples Contain Mutable Items in Python?

    Nov 6, 2024 · Tuples are said to be immutable, but what’s crucial to grasp is that they store references to other objects, not the objects themselves. When you create a tuple containing a …

  10. Why Tuples Can Contain Mutable Items in Python 3

    Oct 18, 2023 · In Python 3, tuples can contain mutable items because the immutability of a tuple refers to the references it holds, not the objects themselves. This means that while the tuple …

  11. Some results have been removed
Refresh