-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT: Backcompat fixes for dragon4 changes #10008
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
Conversation
doc/release/1.14.0-notes.rst
Outdated
@@ -403,6 +403,10 @@ elements uniquely. | |||
Numpy complex-floating-scalars with values like ``inf*j`` or ``nan*j`` now | |||
print as ``infj`` and ``nanj``, like the pure-python ``complex`` type. | |||
|
|||
The ``FloatFormat`` and ``LongFloatFormat`` classes are deprecated and should | |||
both be replaced by ``FloatingFormat``, and similarly ``ComplexFormat`` and |
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.
Nit: might be easier to read as ... . Similarly ...
numpy/core/arrayprint.py
Outdated
class LongFloatFormat(FloatingFormat): | ||
def __init__(self, *args, **kwargs): | ||
warnings.warn("LongFloatFormat has been replaced by FloatingFormat", | ||
DeprecationWarning, stacklevel=1) |
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.
Should this be stacklevel=2
? I think we do that elsewhere.
There's something that sets EDIT: Looks like |
00ba158
to
d7f71c6
Compare
Thanks, fixed stacklevel and release note. |
Comment about the |
d7f71c6
to
a943f58
Compare
OOps, forgot that. Fixed now. |
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!
numpy/core/arrayprint.py
Outdated
@@ -996,6 +1020,22 @@ def __call__(self, x): | |||
i = self.imag_format(x.imag) | |||
return r + i + 'j' | |||
|
|||
# for back-compatibility, we keep the classes for each float type too |
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.
nit: complex type too
[ci-skip]
This is a small fixup to the dragon4 changes as suggested by @eric-wieser in #9941. This adds back in the
FloatFormat
classes that I deleted, but deprecates them.We can also discuss renaming
floatmode
tofloat_mode
. I didn't do that because, while it is true that some functions here use underscores, others don't. Eg, we already uselinewidth
andedgeitems
in the_format_options
dict and as args toset_printoptions
. So I'd arguefloatmode
is the more consistent choice.It's a little strange we only allow
longdouble
to be separately customizable as aformatter
, and not any of the other float types, but I guess that's the way it is, no real harm in leaving it so.