Raise `ValueError` upon attempt to create data-less `Data` by sadielbartholomew · Pull Request #491 · NCAS-CMS/cf-python

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sadie, source can be anything that sufficiently duck types to the class of the object being instantiated. "Sufficiently" meaning that it'll take what it can and ignore what it can't, hence setting it to a string doesn't fail - it just doesn't provide much content (strings don't have dask arrays, etc.). It very commonly used in copy methods, which set source=self.

All cfdm and cf-python classes have a source parameter (because they all inherit from cfdm.core.Container, which has one), so we should perhaps consider improving this docstring in another PR ...