From 2b47b1b4573d19fc8c9201a379d255cc67631c11 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 25 Apr 2021 12:27:43 -0700 Subject: [PATCH] ManifoldSubset.open_superset_family: New --- src/sage/manifolds/subset.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py index 43c44838a30..64b8a9c9c62 100644 --- a/src/sage/manifolds/subset.py +++ b/src/sage/manifolds/subset.py @@ -575,6 +575,11 @@ def open_supersets(self): r""" Generate the open supersets of ``self``. + .. NOTE:: + + To get the open supersets as a family, sorted by name, use the method + :meth:`open_superset_family` instead. + EXAMPLES:: sage: M = Manifold(2, 'M', structure='topological') @@ -590,6 +595,35 @@ def open_supersets(self): if superset.is_open(): yield superset + def open_superset_family(self): + r""" + Return the family of open supersets of ``self``. + + The family is sorted by the alphabetical names of the subsets. + + OUTPUT: + + - a :class:`ManifoldSubsetFiniteFamily` instance containing all the + open supersets that have been defined on the current subset + + .. NOTE:: + + If you only need to iterate over the open supersets in arbitrary + order, you can use the generator method :meth:`open_supersets` + instead. + + EXAMPLES:: + + sage: M = Manifold(2, 'M', structure='topological') + sage: U = M.open_subset('U') + sage: V = U.subset('V') + sage: W = V.subset('W') + sage: W.open_superset_family() + Set {M, U} of open subsets of the 2-dimensional topological manifold M + + """ + return ManifoldSubsetFiniteFamily(self.open_supersets()) + def subsets(self): r""" Generate the subsets that have been defined on the current subset.