This code creates a new list when the code is compiled and sets it as the default for the upstreams parameter. All calls to this function will use that list. Here's a short illusatrative example:
You probably want to set the default parameter to None and then initialize a new list inside the method if upstreams is None, otherwise all pipelines which don't set upstreams when this method is called will share the same upstreams.
You are absolutely right, that's not good style. Luckily in this case it was not doing any harm because the upstreams parameter was only used in a loop.
https://github.com/mara/data-integration/blob/master/data_integration/pipelines.py#L162
def add(self, node: Node, upstreams: [typing.Union[str, Node]] = []) -> 'Pipeline':
This code creates a new list when the code is compiled and sets it as the default for the upstreams parameter. All calls to this function will use that list. Here's a short illusatrative example:
You probably want to set the default parameter to
None
and then initialize a new list inside the method if upstreams isNone
, otherwise all pipelines which don't set upstreams when this method is called will share the same upstreams.