#18076: Coercion for numpy types
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner: vdelecroix
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.7
Component: coercion | Resolution:
Keywords: sd66 | Merged in:
Authors: Vincent | Reviewers: Jeroen Demeyer,
Delecroix, Jeroen Demeyer | Vincent Delecroix
Report Upstream: N/A | Work issues:
Branch: u/jdemeyer/18076 | Commit:
Dependencies: #18121 | d4c53ac38372916a2e81100e2c4dd360b5afcf51
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by jdemeyer):
My comments (all easy to fix):
1. Conversion `numpy.floating` -> `QQ` should use `RR` directly, instead
of `numpy.floating` -> `RDF` which then converts to `RR`.
2. The reference to #15965 is wrong.
3. In `src/sage/rings/real_double.pyx`, I would prefer to split up {{{if S
is ZZ or S is QQ or S is RLF or (isinstance(S, RealField_class) and
S.prec() >= 53)}}} in several cases, just like for `CDF` (in particular,
if the precision is too small, we can return `None` immediately).
4. Python considers `bool` a subclass of `int`, so
{{{
issubclass(py_type, int) or issubclass(py_type, long) or
issubclass(py_type, bool)
}}}
can be replaced by
{{{
issubclass(py_type, int) or issubclass(py_type, long)
}}}
5. In doctests, please replace `1jr` by the more natural `I` (unless you
have a good reason to not do this)
6. In `NumpyToSRMorphism.__init__`, could you raise a `TypeError` if
`numpy_type` doesn't satisfy any of the `issubclass()` checks. Also, the
second `if` should better be an `elif`.
--
Ticket URL: <http://trac.sagemath.org/ticket/18076#comment:35>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.