-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPS: drop py2 from test and doc, remove compat #594 #629
Conversation
Let's not just drop tests without fixing the code. %
|
@fangchenli, unfortunately, there are test failures (mostly/all? related to range function vs kwarg conflict), please fix this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, except for comments above.
Hold on; this patch contains does a bunch of stuff beyond compatibility fixes, changing code like
into
in performance-critical places (arithmetic operations). The |
%
%
|
OK, but in the original code Anyway, what you'd need to profile is actual mpmath code, not the atomic Python operations. |
5000000 loops, best of 5: 91.5 nsec per loop # Python 3.7
|
Timing some mixed mpf arithmetic operations, there doesn't seem to be any measurable impact on performance anymore. So I'll withdraw my objection, considering that the new version of the code is simpler / more idiomatic. |
@fredrik-johansson, from simple benchmarks it looks like isinstance() calls slightly slower:
The other point is that this change is totally unrelated to the subject of this pr (which is big enough). There is nothing wrong with the old code from the py3 point of view, so I would suggest to revert that part. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr still lacks some changes from #597. So far:
- docs/functions/trigonometric.rst
- mpmath/ctx_fp.py (real/imag properties)
- mpmath/ctx_iv.py (numbers abc)
- mpmath/functions/functions.py (real/imag properties)
- mpmath/functions/zeta.py (py2.4 try block)
- mpmath/libmp/libmpf.py (from_float)
- mpmath/math2.py (WA for log/sqrt and real/imag)
- mpmath/rational.py (numbers abc)
- mpmath/tests/torture.py (multiprocessing)
Lets also revert isinstance() changes. This doesn't belongs to the subject of the pr.
mpmath/libmp/libmpf.py, mpmath/ctx_mp.py, mpmath/matrices/matrices.py and mpmath/tests/test_matrices.py still have workarounds for py2 (or py3<3.5). Try grep:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Let's drop the legacy!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me! I made a few comments above, only one of any consequence (the dropping of a finally: ctx.prec = prec
) block.
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@cbm755, thanks! Lets merge this tomorrow. |
@fangchenli, thanks |
close #594