tuples Questions

5

Solved

What is the best/most efficient way to check if all tuple values? Do I need to iterate over all tuple items and check or is there some even better way? For example: t1 = (1, 2, 'abc') t2 = ('', 2...
Sandler asked 1/7, 2015 at 6:49

3

Here's an example that splits a string and parses each item, putting it into a tuple whose size is known at compile time. use std::str::FromStr; fn main() { let some_str = "123,321,312"; let nu...
Frasier asked 10/8, 2016 at 3:33

3

Solved

I have known for a while that the primary difference between lists and tuples in Python is that lists are mutable and tuples are not. Beyond that and the different methods available to them, I know...
Becalmed asked 2/4, 2012 at 0:38

1

Solved

I recently encountered an API with arrays structured with an arbitrary number of repeated tuples. I tried a few alternatives to achieve it but hit problems with types having infinite recursion or j...
Ululate asked 21/2, 2021 at 0:36

6

Solved

Is there a difference between an std::pair and an std::tuple with only two members? (Besides the obvious that std::pair requires two and only two members and tuple may have more or less...)
Quadrisect asked 14/7, 2011 at 0:9

3

Solved

I'm trying to conditionally add types to a tuple template type based on some compile time condition, as follows: template <typename T> class Base { ... } template <int I> class Derived...
Hardness asked 19/4, 2021 at 1:45

2

Solved

We have Boost.PFR and we have the tuple iterator. If we combine the two, we might have a way of applying std algorithms over structs. Does a solution already exist? What I'm looking for is: S a, b;...
Eladiaelaeoptene asked 10/4, 2021 at 11:1

2

Solved

I am trying to create a list based on another list, with the same values repeated 3 times consecutively. At the moment, I am using: >>> my_list = [ 1, 2 ] >>> three_times = [] &gt...
Antiscorbutic asked 17/5, 2016 at 14:56

6

Solved

I have a named tuple class in python class Town(collections.namedtuple('Town', [ 'name', 'population', 'coordinates', 'population', 'capital', 'state_bird'])): # ... I'd like to conve...
Nubilous asked 3/10, 2014 at 14:8

3

Solved

Given the following data frame: import pandas as pd df=pd.DataFrame({'A':['a','b','c'], 'B':[[[1,2],[3,4],[5,6]],[[1,2],[3,4],[5,6]],[[1,2],[3,4],[5,6]]]}) df A B 0 a [[1, 2], [3, 4], [5, 6]] 1...
Beau asked 12/7, 2016 at 16:30

4

Does VB support assignment to a tuple? If so what is the Syntax? Private Function GetPeStream(metadataDiagnostics As DiagnosticBag, peStreamProvider As EmitStreamProvider, metadataOnly As Boolean)...
Bubonocele asked 10/4, 2018 at 9:0

1

Solved

When should I use a Pair over a two element Tuple and vice versa?
Leesa asked 13/3, 2021 at 14:27

11

Solved

I have some data either in a list of lists or a list of tuples, like this: data = [[1,2,3], [4,5,6], [7,8,9]] data = [(1,2,3), (4,5,6), (7,8,9)] And I want to sort by the 2nd element in the subs...
Commentate asked 25/6, 2010 at 23:1

5

Solved

I have a nested tuple structure like (String,(String,Double)) and I want to transform it to (String,String,Double). I have various kinds of nested tuple, and I don't want to transform each manually...
Stitt asked 4/12, 2012 at 8:51

1

Consider the following code: interface Wrap<Value> { pick(): Value } class WrapConstant<Value> implements Wrap<Value> { constructor(public readonly a: Value) { } pick(): Value...
Concoction asked 7/3, 2021 at 17:20

2

Solved

I'm using TensorFlow r1.7 and python3.6.5. I am also very new to TensorFlow, so I'd like easy to read explanations if possible. I'm trying to convert my input data into a dataset of tensors with t...
Empiric asked 13/4, 2018 at 20:43

2

From this data structure : const properties = [ { name: 'name', type: '' }, { name: 'age', type: 0 }, { name: 'sex', type: ['m', 'f'] as const }, { name: 'username', type: '' } ] I am trying t...
Errol asked 5/3, 2021 at 23:9

5

Situation: I have multiple Web service API calls that deliver object structures. Currently, I declare explicit types to bind those object structures together. For the sake of simplicity, here's an ...
Psychognosis asked 29/8, 2017 at 6:20

5

Solved

I have a tuple with two numbers in it, I need to get both numbers. The first number is the x-coordinate, while the second is the y-coordinate. My pseudo code is my idea about how to go about it, ho...
Perform asked 20/7, 2010 at 8:37

2

Solved

I've been hoping to use new C++17 features like fold expressions and std::apply() to simplify some C++11 code I have that uses tools like std::index_sequence and std::initializer_list for some oper...
Aesthetics asked 24/2, 2021 at 18:47

3

Solved

I have defined a tuple and its indices by creating an enum class: /** parameter { key ; value1 ; value1 ; } */ using Parameter = std::tuple<unsigned, unsigned, unsigned>; enum class Paramete...
Iiette asked 11/8, 2017 at 10:20

7

Solved

I have a problem. My program is using config file to set options, and one of those options is a tuple. Here's what i mean: [common] logfile=log.txt db_host=localhost db_user=root db_pass=password ...
Ahab asked 4/11, 2010 at 13:31

2

Solved

Say for example, I have a simple case class case class Foo(k:String, v1:String, v2:String) Can I get spark to recognise this as a tuple for the purposes of something like this, without convertin...
Pforzheim asked 20/1, 2016 at 15:42

3

Solved

I am writing a native function that will return multiple Python objects PyObject *V = PyList_New(0); PyObject *E = PyList_New(0); PyObject *F = PyList_New(0); return Py_BuildValue("ooo", V, E, F)...
Velma asked 16/8, 2010 at 23:25

5

Solved

I'm porting some C# code to VB6 because legacy applications. I need to store a list of pairs. I don't need to do associative lookups, I just need to be able to store pairs of items. The snippet I'...
Largehearted asked 31/8, 2012 at 20:31

© 2022 - 2024 — McMap. All rights reserved.