Top "Tuples" questions

In programming, tuples are simple *product types*, representing ordered collections of types.

Python - Go through list without last element

I have a list of tuples and want to create a new list. The elements of the new list are …

python list loops tuples enumerate
In Scala, is there an easy way to convert a case class into a tuple?

Is there an easy way to convert a case class into a tuple? I can, of course, easily write boilerplate …

scala tuples case-class
How does swapping of members in tuples (a,b)=(b,a) work internally?

In [55]: a = 5 In [56]: b = 6 In [57]: (a, b) = (b, a) In [58]: a Out[58]: 6 In [59]: b Out[59]: 5 How does this swapping of …

python tuples python-internals iterable-unpacking
Anonymous type and tuple

What is the difference between anonymous type and tuple?

c# c#-4.0 language-features anonymous-types tuples
Why are python strings and tuples are made immutable?

I am not sure why strings and tuples were made to be immutable; what are the advantages and disadvantage of …

python string immutability tuples
Julia: Flattening array of array/tuples

In Julia vec reshapes multidimensional arrays into one-dimension arrays. However it doesn't work for arrays of arrays or arrays of …

arrays tuples julia flatten
Python Class __div__ issue

The tuples represent fractions. I'm trying to divide the fractions by multiplying by the reciprical class Test(): def __init__(self): …

python class operators tuples divide
Tuples and unpacking assignment support in C#?

In Python I can write def myMethod(): #some work to find the row and col return (row, col) row, col = …

c# tuples iterable-unpacking decomposition
Why do tuples take less space in memory than lists?

A tuple takes less memory space in Python: >>> a = (1,2,3) >>> a.__sizeof__() 48 whereas lists takes …

python python-2.7 list tuples python-internals
std::tuple get() member function

boost::tuple has a get() member function used like this: tuple<int, string, string> t(5, "foo", "bar"); cout &…

c++ boost c++11 tuples