dazzling-diamond-4749
09/14/2021, 10:18 PMkwargs.get("tags", []) + ["my_tag"]
This doesn't work
kwargs["tags"] = kwargs.get("tags", []).append("my_tag")
Any reason why the later doesn't work? maybe all lists are read only and +
creates a new list that is the combination of the two?hundreds-father-404
09/14/2021, 10:27 PM.append()
returns None
❯ python3
Python 3.9.6 (default, Jun 28 2021, 19:24:41)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [1, 2].append(3)
>>> x
>>> type(x)
<class 'NoneType'>
You could also do kwargs["tags"] = [*kwargs.get("tags", []), "my_tag"]
dazzling-diamond-4749
09/14/2021, 10:28 PMdazzling-diamond-4749
09/14/2021, 10:28 PMbusy-vase-39202
09/14/2021, 10:52 PMdazzling-diamond-4749
09/14/2021, 10:54 PMconst
just so that I can use default left values
(I'm terrible)