sktime / pytorch-forecasting

Time series forecasting with PyTorch
https://pytorch-forecasting.readthedocs.io/
MIT License
3.87k stars 612 forks source link

[MNT] remove mutable objects from defaults #1668

Open fkiraly opened 1 week ago

fkiraly commented 1 week ago

We should ensure that no mutable objects are argument defaults, e.g., lists, dicts.

All mutable defaults should be replaced by appropriate defaults, e.g., strings if applicable, or None, which internally is then replaced by a newly initialized mutable defaults.

Care needs to be taken in cases where a self write happens, e.g., dataclass-like structures should not overwrite the self attr with a mutable default either, instead write the replacement default to self.