About 14,700,000 results
Open links in new tab
  1. 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 …

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

    Sep 9, 2014 · 1 A tuple is useful for storing multiple values.. As you note a tuple is just like a list that is immutable - e.g. once created you cannot add/remove/swap elements. One benefit of …

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

  4. c# - Tuple.Create () vs new Tuple - Stack Overflow

    Dec 13, 2014 · new Tuple<int,int>(1,2); Tuple.Create(1,2); Is there any difference between these two methods of Tuple creation? From my reading it seems to be more a convenient shorthand …

  5. Python typing: tuple [str] vs tuple [str, ...] - Stack Overflow

    Apr 25, 2022 · The difference with other collections is probably because tuples are immutable.

  6. How can I convert a tuple to a float in python? - Stack Overflow

    Dec 9, 2013 · Say I created a tuple like this using a byte array: import struct a = struct.unpack('f', 'helo') How can I now convert a into a float? Any ideas?

  7. Type hinting tuples in Python - Stack Overflow

    Nov 28, 2017 · def func(var: list[int]): # do something func([1]) # would be fine func([1, 2]) # would also be fine func([1, 2, 3]) # would also be fine That's consequentially, in a way, because of …

  8. c# - How to name tuple properties? - Stack Overflow

    How and "could be" organized return from the method which returns tuple type with the name of parameters, as an example private static Tuple&lt;string, string&gt; methodTuple() { return new …

  9. python - List vs tuple, when to use each? - Stack Overflow

    Using a tuple instead of a list is like having an implied assert statement that this data is constant, and that special thought (and a specific function) is required to override that. Some tuples can …

  10. Create a Tuple in a Linq Select - Stack Overflow

    Nov 5, 2015 · .Select(c => new Tuple<string, byte>(c.Id, c.Flag)) .ToList(); This method lets you work with Linq to Object instead Linq to Entities, so after call it,you can project the result of …