Examples of finite enumerated sets

class sage.categories.examples.finite_enumerated_sets.Example

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

An example of a finite enumerated set: \{1,2,3\}

This class provides a minimal implementation of a finite enumerated set.

EXAMPLES:

sage: C = FiniteEnumeratedSets().example()
sage: C.cardinality()
3
sage: C.list()
[1, 2, 3]
sage: C.an_element()
1

This checks that the different methods of the enumerated set C return consistent results:

sage: TestSuite(C).run(verbose = True)
running ._test_an_element() . . . pass
running ._test_category() . . . pass
running ._test_elements() . . .
  Running the test suite of self.an_element()
  running ._test_pickling() . . . pass
  pass
running ._test_enumerated_set_contains() . . . pass
running ._test_enumerated_set_iter_cardinality() . . . pass
running ._test_enumerated_set_iter_list() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
running ._test_some_elements() . . . pass
class Element(value, parent)
Bases: sage.structure.element_wrapper.ElementWrapper
Example.an_element(*args, **kwds)

An element in self.

self.an_element() returns a particular element of the set self. This is a generic implementation from the category EnumeratedSet() which can be used when the method __iter__ is provided.

EXAMPLES:

sage: C = FiniteEnumeratedSets().example()
sage: C.an_element() # indirect doctest
1

Previous topic

Examples of finite Coxeter groups

Next topic

Examples of finite monoids

This Page