Open
Description
I was thinking about implementing support for multiple inputs (and maybe outputs) to pipelines. For example, it would be nice to be able to
@pipeline
def add(a1, a2):
return a1 + a2
i1 = pims.open("img1.tif")
i2 = pims.open("img2.tif")
i12 = add(i1, i2)
Before I start I wanted to ask how to go about it. A few possibilities, decreasing in elegance (in my opinion) but increasing in API compatibility:
- Extend the
Pipeline
class (andpipeline
decorator)- Rearrange
__init__
arguments:def __init__(proc_func, *ancestors, propagate_attrs=None)
. This breaks the API. - Keep
__init__
arguments in order:def __init__(*args, propagate_attrs=None)
, whereargs[-1]
isproc_func
. This turnspropagate_attrs
into a keyword-only andproc_func
andancestor
into positional arguments but otherwise preserves the API. - Preserve the API:
def __init__(ancestor, proc_func, propagate_attrs=None, *other_ancestors)
- Some middle ground between the above
- Rearrange
- Create a new class (and decorator). Complete freedom since there is no backward-compatibility to think of.
- Something else I did not think about
Which is the preferred way?
Metadata
Assignees
Labels
No labels
Activity