3 ms·
Note that tuples are immutable in python. I usually use tuples as default values for collections: def f(x=()): x = list(x) ... def g(y=(())) y = dict(y
by t1m 13y ago
Note that tuples are immutable in python. I usually use tuples as default values for collections:
def f(x=()):
x = list(x)
...
def g(y=(()))
y = dict(y)
...
f() is the pattern for lists, g() is for dicts. Note that you can pass in regular lists to f() and regular dicts to g().