About 59 results
Open links in new tab
  1. 如何理解和使用tuple? - 知乎

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

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

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

  5. python - Convert numpy array to tuple - Stack Overflow

    Apr 5, 2012 · Note: This is asking for the reverse of the usual tuple-to-array conversion. I have to pass an argument to a (wrapped c++) function as a nested tuple. For example, the following …

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

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

  8. python - Multiple variables using tuple - Stack Overflow

    This doesn't store the tuple anywhere, so you'll be left with 4 variables with 4 different values. When you change the value of country, you change the value of this single variable, not of the …

  9. python - how to add value to a tuple? - Stack Overflow

    5 I was going through some details related to tuple and list, and what I understood is: Tuples are Heterogeneous collection data type Tuple has Fixed length (per tuple type) Tuple are Always …

  10. Python add item to the tuple - Stack Overflow

    Feb 17, 2022 · I have some object.ID-s which I try to store in the user session as tuple. When I add first one it works but tuple looks like (u'2',) but when I try to add new one using mytuple = …