-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Current situation
The construct and construct_key methods take a single positional identity argument (https://github.com/NCAS-CMS/cfdm/blob/v1.8.8.0/cfdm/mixin/constructaccess.py#L301):
def construct(self, identity, default=ValueError()):Proposed change
The construct and construct_key methods take any number of positional arguments, as well as new keyword arguments:
def construct(self, *identity, default=ValueError(), **filter_kwargs):The **filter_kwargs are passed to the new Constructs.filter method for further selection flexibility.
This makes sense, as you can already match on multiple identities by providing a re.Pattern object, so it doesn't makes sense to restrict this to, say, *["latitude", "longitude"]
Consequences
The only possibly bad effect that this could have is for the default argument to be consumed by the *identity arguments if it is given as a positional parameter. For example, to Specify a default of None:
>>> f.construct('altitude', None) # ok at v1.8.8.0
>>> f.construct('altitude', None) # NOT ok with proposed change
>>> f.construct('altitude', default=None) # ok with proposed change and at v1.8.8.0Regardless of this potential for code breaking, I think this change will be beneficial.