About 50 results
Open links in new tab
  1. 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.

  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 - 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?

  4. 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 …

  5. 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 …

  6. 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.

  7. 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

  8. 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

  9. python - Iterate a list of tuples - Stack Overflow

    On top of that I would like to alter the tuples in the list. Standard practice is to avoid changing a list while also iterating through it, so what should I do?

  10. python - What is the difference between lists,tuples,sets and ...

    I have confused with lists, tuples, sets and dictionaries someone give me clear cut idea. Give me the difference from your understanding don't give the text book definitions.