-
-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This new module will provide abstract base classes for the purpose of `isinstance` and `issubclass` testing. This helps with modularization (#32432). In this ticket, we add `RealField`, `RealDoubleField`, `ComplexField`, `ComplexDoubleField`, which are in 1:1 correspondence to the implementation classes `RealField_class`, `RealDoubleField_class`, `ComplexField_class`, `ComplexDoubleField_class`. To illustrate the use of these classes, we convert some uses of `is_...` functions to `isinstance` with the new base classes. Related: - https://groups.google.com/g/sage-devel/c/T0A4JCOg9DY/m/q6WKsI1yBAAJ (Sep 2021) Part of meta-ticket #32414. URL: https://trac.sagemath.org/32566 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): Jonathan Kliem
- Loading branch information
Showing
10 changed files
with
87 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from .ring cimport Field | ||
|
||
cdef class RealField(Field): | ||
|
||
pass | ||
|
||
|
||
cdef class RealDoubleField(Field): | ||
|
||
pass | ||
|
||
|
||
cdef class ComplexField(Field): | ||
|
||
pass | ||
|
||
|
||
cdef class ComplexDoubleField(Field): | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
Abstract base classes for rings | ||
""" | ||
|
||
cdef class RealField(Field): | ||
r""" | ||
Abstract base class for :class:`~sage.rings.real_mpfr.RealField_class`. | ||
""" | ||
|
||
pass | ||
|
||
|
||
cdef class RealDoubleField(Field): | ||
r""" | ||
Abstract base class for :class:`~sage.rings.real_double.RealDoubleField_class`. | ||
""" | ||
|
||
pass | ||
|
||
|
||
cdef class ComplexField(Field): | ||
r""" | ||
Abstract base class for :class:`~sage.rings.complex_mpfr.ComplexField_class`. | ||
""" | ||
|
||
pass | ||
|
||
|
||
cdef class ComplexDoubleField(Field): | ||
r""" | ||
Abstract base class for :class:`~sage.rings.complex_double.ComplexDoubleField_class`. | ||
""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters