2 ms·
This is how I use it. If I want an empty list as a default argument for some function, I do something like this: def foo(things: Optional[List[str]] = None
by albrewer 5y ago
This is how I use it. If I want an empty list as a default argument for some function, I do something like this:
def foo(things: Optional[List[str]] = None) -> None:
thing_list = things if things else []
...