For background, see What is a facade set?.

TESTS:

sage: C = Sets.Finite(); C
Category of finite sets
sage: type(C)
<class 'sage.categories.finite_sets.FiniteSets_with_category'>
sage: type(C).__base__.__base__
<class 'sage.categories.category_with_axiom.CategoryWithAxiom_singleton'>

sage: TestSuite(C).run()

class ParentMethods

Returns the parents this set is a facade for

This default implementation assumes that self has an attribute _facade_for, typically initialized by Parent.__init__(). If the attribute is not present, the method raises a NotImplementedError.

EXAMPLES:

sage: S = Sets().Facade().example(); S
An example of facade set: the monoid of positive integers
(Integer Ring,)


Check that trac ticket #13801 is corrected:

sage: class A(Parent):
....:     def __init__(self):
sage: a = A()
Traceback (most recent call last):
...
NotImplementedError: this parent did not specify which parents it is a facade for

is_parent_of(element)

Returns whether self is the parent of element

INPUT:

• element – any object

Since self is a facade domain, this actually tests whether the parent of element is any of the parent self is a facade for.

EXAMPLES:

sage: S = Sets().Facade().example(); S
An example of facade set: the monoid of positive integers
sage: S.is_parent_of(1)
True
sage: S.is_parent_of(1/2)
False


This method differs from __contains__() in two ways. First, this does not take into account the fact that self may be a strict subset of the parent(s) it is a facade for:

sage: -1 in S, S.is_parent_of(-1)
(False, True)


Furthermore, there is no coercion attempted:

sage: int(1) in S, S.is_parent_of(int(1))
(True, False)


Warning

this implementation does not handle facade parents of facade parents. Is this a feature we want generically?

Returns an example of facade set, as per Category.example().

INPUT:

• choice – ‘union’ or ‘subset’ (default: ‘subset’).

EXAMPLES:

sage: Sets().Facade().example()
An example of facade set: the monoid of positive integers
An example of a facade set: the integers completed by +-infinity