iode.Database.is_copy_subset

Note

Below, Database represents either:

  • Comments

  • Equations

  • Identities

  • Lists

  • Scalars

  • Tables

  • Variables

Database.is_copy_subset(self) bool

Whether or not the present object represents of a subset of a global IODE database and if the IODE objects of the subset represent deep copies of the IODE objects from the global IODE database.

A deep copy subset means that any change made on an object of the subset will NOT modify the corresponding object in the global IODE database.

A shallow copy subset means that any change made on an object of the subset will also modify the corresponding object in the global IODE database.

By default, the iode.CommentsDatabase.subset() method return a shallow copy subset.

Returns:
bool

Examples

>>> from iode import SAMPLE_DATA_DIR
>>> from iode import comments
>>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt")
>>> comments.is_subset()
False
>>> cmt_subset = comments["A*"].copy()
>>> cmt_subset.is_subset()
True
>>> cmt_subset.is_copy_subset()
True