About 106,000 results
Open links in new tab
  1. python - List vs tuple, when to use each? - Stack Overflow

    Using a tuple instead of a list is like having an implied assert statement that this data is constant, and that special thought (and a specific function) is required to override that. Some tuples can …

  2. python - What's the difference between lists and tuples ... - Stack ...

    Mar 9, 2009 · In a list the values all have the same type and the length is not fixed. So the difference is very obvious. Finally there is the namedtuple in Python, which makes sense …

  3. Are tuples more efficient than lists in Python? - Stack Overflow

    FWIW, list access is faster that tuple access in Python 2 but only because there is a special case for lists in BINARY_SUBSCR in Python/ceval.c. In Python 3, that optimization is gone, and …

  4. Python Sets vs Lists - Stack Overflow

    May 14, 2010 · In Python 2, set is always the slowest. or is the fastest for 2 to 3 literals, and tuple and list are faster with 4 or more literals. I couldn't distinguish the speed of tuple vs list.

  5. python - Static typing in python3: list vs List - Stack Overflow

    Oct 3, 2018 · 41 This question already has answers here: Using List/Tuple/etc. from typing vs directly referring type as list/tuple/etc (3 answers)

  6. python - Using List/Tuple/etc. from typing vs directly referring …

    Sep 12, 2016 · What's the difference of using List, Tuple, etc. from typing module: from typing import Tuple def f (points: Tuple): return map (do_stuff, points) As opposed to referring to …

  7. python - what is difference betwen string and tuple? - Stack …

    Mar 14, 2019 · Tuple they are immutable like strings and sequence like lists.They are used to store data just like list, just like string you cannot update or edit the tuple to change it you have …

  8. Python memory consumption: dict VS list of tuples

    Apr 16, 2016 · 37 Your list of tuple s adds an extra layer. You have 3 layers of items: The outer list of length 1 million, so 1 million pointers 1 million 2-slot tuples, so 2 million pointers 2 million …

  9. What are differences between List, Dictionary and Tuple in Python ...

    Sep 6, 2010 · A list can store a sequence of objects in a certain order such that you can index into the list, or iterate over the list. List is a mutable type meaning that lists can be modified after …

  10. Why is tuple faster than list in Python? - Stack Overflow

    Jul 31, 2019 · 103 I've just read in "Dive into Python" that "tuples are faster than lists". Tuple is immutable, and list is mutable, but I don't quite understand why tuple is faster. Anyone did a …