home.social

#tuples — Public Fediverse posts

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

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

  2. @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 [:]. 🤷

    [...]