home.social

#tuples — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #tuples, aggregated by home.social.

  1. Rust's tuples are not enough? Np.

    🦀 **tuplers** — A crate that provides many useful tools for tuples.

    🔄 e.g. map, flatten, transpose, sort, split more!

    🔥 Supports no-std & WASM targets.

    ⭐ GitHub: github.com/libsugar/tuplers

  2. Tuple concatenation in Python:
    Tuple concatenation in Python means combining two or more tuples using the + operator.
    #python #tuples #pythontips #TupleConcatenation #codesnippet #learnpython

  3. Tuple concatenation in Python:
    Tuple concatenation in Python means combining two or more tuples using the + operator.
    #python #tuples #pythontips #TupleConcatenation #codesnippet #learnpython

  4. Tuple concatenation in Python:
    Tuple concatenation in Python means combining two or more tuples using the + operator.
    #python #tuples #pythontips #TupleConcatenation #codesnippet #learnpython

  5. Tuple concatenation in Python:
    Tuple concatenation in Python means combining two or more tuples using the + operator.
    #python #tuples #pythontips #TupleConcatenation #codesnippet #learnpython

  6. Tuple concatenation in Python:
    Tuple concatenation in Python means combining two or more tuples using the + operator.
    #python #tuples #pythontips #TupleConcatenation #codesnippet #learnpython

  7. @skimlines @cs

    It's fine for #lists - but it's not the most "#Pythonic" way to do this, at least for lists. Like some other built-in objects, lists have a method `.copy()` which does what it says - returns a #copy of the #object. That's more obvious than using `...[:]` when reading the code, so that tends to be the preferred way in Python.

    Unfortunately, #tuples don't have .copy(). They do support [:]. 🤷

    [...]

  8. Quick Python Quiz - Lists vs. Tuples!

    Can you explain this? What's the difference between a list and a tuple in Python?

    #python #pythoncode #lists #tuples #analytics

  9. Does anyone know of a Python linter which will warn when you forget the trailing comma in something which was *supposed* to be a tuple? Today's example was:

    args = [("f'oo", "bar"), ("baz")]

    The second item in the list ends up being a list of characters instead of a 1-element tuple. Grr.

    #Python #Linting #Tuples

  10. @khalidabuhakmeh my vote is that the objects in #tuples in #CSharp should be PascalCase to match with the style guide for #dotnet as they're treated like properties of the object.

    Once deconstructed, they're local variables and would get camelCase.

  11. @benjiyork Okay. So I use #Tuples as a return from a function if there is more than one value (like a vector). Got it! Thank you :blobnerd:

  12. I’ll be mostly posting about #Python in the data analysis and science and related domains here…

    …but for those learning to code, whatever the final aim, it’s good to get a broad perspective

    So here’s something different to learn about or consolidate the key data structures in Python - lists, tuples, dictionaries, and sets

    Here’s the link to the article for those who want a “diversion” from more serious-looking exercises!

    thepythoncodingbook.com/2021/1

    #Python #Programming #Coding #Lists #Dictionaries #Tuples #Sets #DataStructures

  13. The common solution in the #java #programming #language is not to return #tuples at all. Instead, we expect the programmer to create a custom data type which holds and can access a tuple's elements as strongly, statically typed class instance fields.

    This is normal, for java.

    It's also a lot of work.

    It's verbose, repetitive, and each type requires a ton of testing, which is equally verbose and repetitive.

    Time for java to embrace tuples!