sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.19k stars 411 forks source link

Ring reimplements is_commutative #32810

Open videlec opened 2 years ago

videlec commented 2 years ago

The Ring class erases the implementation from the category

sage: class A(Parent):
....:     def __init__(self):
....:         Parent.__init__(self, category=Rings().Commutative())
sage: A().is_commutative()
True

but

sage: class B(Ring):
....:     def __init__(self):
....:         Parent.__init__(self, category=Rings().Commutative())
....:     def is_zero(self):
....:         return False
Traceback (most recent call last):
...
sage: B().is_commutative()
.../sage/rings/ring.pyx in sage.rings.ring.Ring.is_commutative (build/cythonized/sage/rings/ring.c:7752)()
    779         if self.is_zero():
    780             return True
--> 781         raise NotImplementedError
    782 
    783     def is_field(self, proof = True):

NotImplementedError: 

Component: PLEASE CHANGE

Issue created by migration from https://trac.sagemath.org/ticket/32810

fchapoton commented 1 year ago
comment:4

see also #33757