About 94,300 results
Open links in new tab
  1. python - What's the difference between lists and tuples ... - Stack ...

    Mar 9, 2009 · What are the differences between lists and tuples, and what are their respective advantages and disadvantages?

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

    Summary Tuples tend to perform better than lists in almost every category: Tuples can be constant folded. Tuples can be reused instead of copied. Tuples are compact and don't over-allocate. Tuples …

  3. python - List vs tuple, when to use each? - Stack Overflow

    In Python, when should you use lists and when tuples? Sometimes you don't have a choice, for example if you have "hello %s you are %s years old" % x then x must be a tuple.

  4. python - How to merge lists into a list of tuples? - Stack Overflow

    How to merge lists into a list of tuples? Asked 15 years, 9 months ago Modified 3 years, 11 months ago Viewed 381k times

  5. python - How to sort a list/tuple of lists/tuples by the element at a ...

    With regard to "Should I store tuples or lists in my list?", a rule of thumb is to make things as immutable as possible. If you don't need to modify the sublists in place, make them tuples.

  6. python - What is a tuple useful for? - Stack Overflow

    Sep 9, 2014 · In Python, a list is sometimes converted into a tuple for use as a dictionary key, because Python dictionary keys need to be immutable (i.e. constant) values, whereas Python lists are mutable …

  7. In Python, when to use a Dictionary, List or Set?

    Jul 1, 2019 · 1 Dictionary: A python dictionary is used like a hash table with key as index and object as value. List: A list is used for holding objects in an array indexed by position of that object in the array. …

  8. Zip lists in Python - Stack Overflow

    23 In Python 3 zip returns an iterator instead and needs to be passed to a list function to get the zipped tuples:

  9. What is the difference between lists and tuples in Python?

    Jul 28, 2010 · A useful variant of tuple is its sub-type collections.namedtuple (requires Python 2.6 or better) which lets you access items by name (with attribute syntax) as well as by index (the normal …

  10. python - Unpacking a list / tuple of pairs into two lists / tuples ...

    Unpacking a list / tuple of pairs into two lists / tuples [duplicate] Asked 14 years, 2 months ago Modified 2 years, 10 months ago Viewed 259k times