tagged [tuples]

Equivalent of Tuple (.NET 4) for .NET Framework 3.5

Equivalent of Tuple (.NET 4) for .NET Framework 3.5 Is there a class existing in .NET Framework 3.5 that would be equivalent to the .NET 4 [Tuple](http://msdn.microsoft.com/en-us/library/system.tuple....

14 Apr at 07:40

Ignore python multiple return value

Ignore python multiple return value Say I have a Python function that returns multiple values in a tuple: Is there a nice way to ignore one of the results rather than just assigning to a temporary var...

10 Jan at 22:12

Select value from list of tuples where condition

Select value from list of tuples where condition I have a list of tuples. Every tuple has 5 elements (corresponding to 5 database columns) and I'd like to make a query e.g. Is it possible to query the...

20 Mar at 11:26

How to find the maximum value in a list of tuples?

How to find the maximum value in a list of tuples? I have a list with ~10^6 tuples in it like this: I want to find the maximum value of the `Y`s in this list, but also want to know the `X` that it is ...

20 Mar at 02:35

Subtracting 2 lists in Python

Subtracting 2 lists in Python Right now I have vector3 values represented as lists. is there a way to subtract 2 of these like vector3 values, like Should I use tuples? If none of them defines these o...

9 Oct at 12:9

How to search a list of tuples in Python

How to search a list of tuples in Python So I have a list of tuples such as this: I want this list for a tuple whose number value is equal to something. So that if I do `search(53)` it will return the...

10 Apr at 20:52

Get all pairs in a list using LINQ

Get all pairs in a list using LINQ How do I get all possible pairs of items in a list (order not relevant)? E.g. if I have I would like to get these tuples:

3 May at 18:57

Is there a version of the class Tuple whose Items properties are not readonly and can be set?

Is there a version of the class Tuple whose Items properties are not readonly and can be set? I want to know whether there is a built-in version of the class `Tuple` whose Items properties are not `re...

6 Aug at 21:47

How to unzip a list of tuples into individual lists?

How to unzip a list of tuples into individual lists? I have a list of tuples `l = [(1,2), (3,4), (8,9)]`. How can I, succinctly and Pythonically, unzip this list into two independent lists, to get `[ ...

14 Jan at 08:30

how to iterate over tuple items

how to iterate over tuple items How to iterate over items in a Tuple, when I dont know at compile-time what are the types the tuple is composed of? I just need an IEnumerable of objects (for serializa...

11 Apr at 08:56

What's the difference between System.ValueTuple and System.Tuple?

What's the difference between System.ValueTuple and System.Tuple? I decompiled some C# 7 libraries and saw `ValueTuple` generics being used. What are `ValueTuples` and why not `Tuple` instead? - [http...

14 Dec at 14:47

In C# 7 is it possible to deconstruct tuples as method arguments

In C# 7 is it possible to deconstruct tuples as method arguments For example I have I would like to write something like this ``` private void test(Action> fn) { fn(("hello", 10)); } te

16 Mar at 01:31

Python element-wise tuple operations like sum

Python element-wise tuple operations like sum Is there anyway to get tuple operations in Python to work like this: instead of: I know it works like that because the `__add__` and `__mul__` methods are...

19 Dec at 18:17

2D arrays in Python

2D arrays in Python What's the best way to create 2D arrays in Python? What I want is want is to store values like this: so that I access data like `X[2],Y[2],Z[2]` or `X[n],Y[n],Z[n]` where `n` is va...

Use attributes for value tuples

Use attributes for value tuples In C# 7.0, .NET introduces a new return value tuple types (functional programming), so instead of: I'd like to use value tuples: And I want to use attributes for these ...

ValueTuples lose their property names when serialized

ValueTuples lose their property names when serialized While trying to serialize a named value tuple to JSON string, it loses the names assigned to items I am expecting the serialized value as > {"type...

28 Jan at 08:47

How to name tuple properties?

How to name tuple properties? How and "could be" organized return from the method which returns tuple type with the name of parameters, as an example and call parameters like `methodTuple.Na

4 Oct at 19:16

Dapper materializing to a Tuple

Dapper materializing to a Tuple I need return a list from dapper with the new tuple in C# 7. ``` public static List GetOnlyServices() { var query = $@" SELECT ST.style_id as StyleId, ST.st...

12 Jan at 17:52

Tuple == Confusion

Tuple == Confusion Suppose I define two tuples: If I try to compare the tuples, I get different results ``` bool result1 = (tuple1 == tuple2); // FALSE bool result2 = tupl

22 Mar at 16:39

Reference an Element in a List of Tuples

Reference an Element in a List of Tuples Sorry in advance, but I'm new to Python. I have a list of `tuples`, and I was wondering how I can reference, say, the first element of each `tuple` within the ...

24 Jun at 06:59

Tuples (or arrays) as Dictionary keys in C#

Tuples (or arrays) as Dictionary keys in C# I am trying to make a Dictionary lookup table in C#. I need to resolve a 3-tuple of values to one string. I tried using arrays as keys, but that did not wor...

2 Jan at 04:52

Expanding tuples into arguments

Expanding tuples into arguments Suppose I have a function like: Given a tuple `some_tuple = (1, "foo", "bar")`, how would I use `some_tuple` to call `myfun`? This should output the result `(2, "foobar...

27 Feb at 21:19

OrmLite pass tuple of parameter

OrmLite pass tuple of parameter I want to pass a list of objects with two properties as a parameter in a ServiceStack OrmLite query but it is run an error Parameter class: Query: ``` select * from (va...

C# 7.0 ValueTuples vs Anonymous Types

C# 7.0 ValueTuples vs Anonymous Types Looking at the new C# 7.0 ValueTuples, I am wondering if they will completely replace `Anonymous Types`. I understand that `ValueTuples` are structs and therefore...

12 Apr at 07:47

how to add value to a tuple?

how to add value to a tuple? I'm working on a script where I have a list of tuples like `('1','2','3','4')`. e.g.: Now I need to add `'1234'`, `'2345'`,`'3456'` and `'4567'` respectively at the end of...

6 Feb at 13:3