About 57 results
Open links in new tab
  1. types - What are "named tuples" in Python? - Stack Overflow

    Jun 4, 2010 · Named tuples are basically easy-to-create, lightweight object types. Named tuple instances can be referenced using object-like variable dereferencing or the standard tuple syntax. …

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

    Sep 9, 2014 · A tuple is a good way to pack multiple values into that cookie without having to define a separate class to contain them. I try to be judicious about this particular use, though.

  3. 如何理解和使用tuple? - 知乎

    tuple一般在中文中称为元组,或者说n元组。就是由n个元素组成的一种有序数据结构(当然n是不小于零的整数)。不同的编程语言对元组有不同实现,但既然标签打的Python,那就只谈和Python中的元 …

  4. list - What exactly are tuples in Python? - Stack Overflow

    A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, …

  5. python - How to change values in a tuple? - Stack Overflow

    It seems unnecessary and memory inefficient to recast into a list and use a temporary variable. You can just unpack into a tuple with the same name and while unpacking update whatever needs updating.

  6. How does tuple comparison work in Python? - Stack Overflow

    Tuples are compared position by position: the first item of the first tuple is compared to the first item of the second tuple; if they are not equal (i.e. the first is greater or smaller than the second) then that's …

  7. Convert list to tuple in Python - Stack Overflow

    Have you assigned the name 'tuple' as a variable name? it should work fine. L is a list and we want to convert it to a tuple. L = [1, 2, 3] tuple (L) By invoking tuple, you convert the list (L) into a tuple. As …

  8. Initialize tuple using user defined constructor without moving

    Mar 20, 2025 · I have a situation where I have a templated class that contains a tuple. The elements must be initialized (they all have compatible constructor), but cannot be moved. Simplified code …

  9. How to create tuple with a loop in python - Stack Overflow

    Feb 17, 2018 · 3 A tuple is an immutable list. This means that, once you create a tuple, it cannot be modified. Read more about tuples and other sequential data types here.

  10. What does the term "Tuple" Mean in Relational Databases?

    Apr 15, 2009 · This answer fails to distinguish the different meanings of the term "tuple" by default in mathematics (ordered) vs in relational database contexts (unordered name-value pair sets).