@@ -424,10 +424,10 @@ class is directly created, then the cache is not used::
424
424
Using :class:`CachedRepresentation` has the advantage that one has a class and
425
425
creates cached instances of this class by the usual Python syntax::
426
426
427
- sage: G = SymmetricGroup(6)
428
- sage: issubclass(SymmetricGroup, sage.structure.unique_representation.CachedRepresentation)
427
+ sage: G = SymmetricGroup(6) # optional - sage.groups
428
+ sage: issubclass(SymmetricGroup, sage.structure.unique_representation.CachedRepresentation) # optional - sage.groups
429
429
True
430
- sage: isinstance(G, SymmetricGroup)
430
+ sage: isinstance(G, SymmetricGroup) # optional - sage.groups
431
431
True
432
432
433
433
In contrast, a factory is just a callable object that returns something that
@@ -502,9 +502,9 @@ class :class:`~sage.misc.fast_methods.WithEqualityById`, which provides
502
502
sage: G3 = G.subgroup([G((1,2,3,4,5,6)), G((1,2))]) # optional - sage.groups
503
503
sage: G is G3 # optional - sage.groups
504
504
False
505
- sage: type(G) == type(G3)
505
+ sage: type(G) == type(G3) # optional - sage.groups
506
506
False
507
- sage: G == G3
507
+ sage: G == G3 # optional - sage.groups
508
508
True
509
509
510
510
The unique representation behaviour can conveniently be implemented with a
@@ -517,9 +517,9 @@ class that inherits from :class:`UniqueRepresentation`: By adding
517
517
ring. Thus, it is reasonable to use :class:`UniqueRepresentation` in this
518
518
case::
519
519
520
- sage: isinstance(SymmetricFunctions(CC), SymmetricFunctions)
520
+ sage: isinstance(SymmetricFunctions(CC), SymmetricFunctions) # optional - sage.combinat
521
521
True
522
- sage: issubclass(SymmetricFunctions, UniqueRepresentation)
522
+ sage: issubclass(SymmetricFunctions, UniqueRepresentation) # optional - sage.combinat
523
523
True
524
524
525
525
:class:`UniqueRepresentation` differs from :class:`CachedRepresentation` only
@@ -1188,15 +1188,15 @@ class UniqueRepresentation(CachedRepresentation, WithEqualityById):
1188
1188
the same memory representation), if and only if they were created using
1189
1189
equal arguments. For example, calling twice::
1190
1190
1191
- sage: f = SymmetricFunctions(QQ) # optional - sage.combinat
1192
- sage: g = SymmetricFunctions(QQ) # optional - sage.combinat
1191
+ sage: f = SymmetricFunctions(QQ) # optional - sage.combinat sage.modules
1192
+ sage: g = SymmetricFunctions(QQ) # optional - sage.combinat sage.modules
1193
1193
1194
1194
to create the symmetric function algebra over `\QQ` actually gives back the
1195
1195
same object::
1196
1196
1197
- sage: f == g # optional - sage.combinat
1197
+ sage: f == g # optional - sage.combinat sage.modules
1198
1198
True
1199
- sage: f is g # optional - sage.combinat
1199
+ sage: f is g # optional - sage.combinat sage.modules
1200
1200
True
1201
1201
1202
1202
This is a standard design pattern. It allows for sharing cached data (say
@@ -1211,9 +1211,9 @@ class UniqueRepresentation(CachedRepresentation, WithEqualityById):
1211
1211
derive from it, or make sure some of its super classes does. Also, it
1212
1212
groups together the class and the factory in a single gadget::
1213
1213
1214
- sage: isinstance(SymmetricFunctions(CC), SymmetricFunctions) # optional - sage.combinat
1214
+ sage: isinstance(SymmetricFunctions(CC), SymmetricFunctions) # optional - sage.combinat sage.modules
1215
1215
True
1216
- sage: issubclass(SymmetricFunctions, UniqueRepresentation) # optional - sage.combinat
1216
+ sage: issubclass(SymmetricFunctions, UniqueRepresentation) # optional - sage.combinat sage.modules
1217
1217
True
1218
1218
1219
1219
This nice behaviour is not available when one just uses a factory::
@@ -1223,7 +1223,7 @@ class UniqueRepresentation(CachedRepresentation, WithEqualityById):
1223
1223
...
1224
1224
TypeError: isinstance() arg 2 must be a type...
1225
1225
1226
- sage: isinstance(GF, sage.structure.factory.UniqueFactory)
1226
+ sage: isinstance(GF, sage.structure.factory.UniqueFactory) # optional - sage.rings.finite_rings
1227
1227
True
1228
1228
1229
1229
In addition, :class:`~sage.structure.factory.UniqueFactory` only provides
0 commit comments