Skip to content

Commit c1d38c7

Browse files
committed
a simple change of detail in unique_representation
1 parent b693ea9 commit c1d38c7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/sage/structure/unique_representation.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ def __classcall__(cls, *args, **options):
10081008
True
10091009
"""
10101010
instance = typecall(cls, *args, **options)
1011-
assert isinstance( instance, cls )
1011+
assert isinstance(instance, cls)
10121012
if instance.__class__.__reduce__ == CachedRepresentation.__reduce__:
10131013
instance._reduction = (cls, args, options)
10141014
return instance
@@ -1090,16 +1090,14 @@ def _clear_cache_(cls):
10901090
sage: c is C(3)
10911091
False
10921092
"""
1093-
del_list = []
10941093
cache = None
1094+
# not clear why the loop below is taking the last C
10951095
for C in cls.mro():
10961096
try:
10971097
cache = C.__classcall__.cache
10981098
except AttributeError:
10991099
pass
1100-
for k in cache:
1101-
if issubclass(k[0][0],cls):
1102-
del_list.append(k)
1100+
del_list = [k for k in cache if issubclass(k[0][0], cls)]
11031101
for k in del_list:
11041102
del cache[k]
11051103

@@ -1149,6 +1147,7 @@ def __deepcopy__(self, memo):
11491147
"""
11501148
return self
11511149

1150+
11521151
def unreduce(cls, args, keywords):
11531152
"""
11541153
Calls a class on the given arguments::
@@ -1166,7 +1165,7 @@ def unreduce(cls, args, keywords):
11661165

11671166
class UniqueRepresentation(CachedRepresentation, WithEqualityById):
11681167
r"""
1169-
Classes derived from UniqueRepresentation inherit a unique
1168+
Classes derived from ``UniqueRepresentation`` inherit a unique
11701169
representation behavior for their instances.
11711170
11721171
.. SEEALSO::

0 commit comments

Comments
 (0)