Skip to content

BUG: stray comma should be preserved for legacy printing - #10120

Merged
eric-wieser merged 1 commit into
numpy:masterfrom
ahaldane:legacy_stray_comma
Nov 29, 2017
Merged

eric-wieser merged 1 commit into
numpy:masterfrom
ahaldane:legacy_stray_comma

Conversation

@ahaldane

Copy link
Copy Markdown
Member

Fixes #10059

@ahaldane ahaldane added this to the 1.14.0 release milestone Nov 29, 2017
Comment thread numpy/core/arrayprint.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It felt a lot cleaner to me to do this concatenation here - can lecacy be forwarded to _formatArray instead?

@ahaldane

Copy link
Copy Markdown
Member Author

Updated.

Comment thread numpy/core/arrayprint.py
def _formatArray(a, format_function, rank, max_line_len,
next_line_prefix, separator, edge_items, summary_insert):
def _formatArray(a, format_function, rank, max_line_len, next_line_prefix,
separator, edge_items, summary_insert, legacy):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe default to =False, just in case anyone is relying on these internals? Not that we have to support them, but it's easy to do so.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I want to gut this whole function to fix #9816, so let's leave this as is


def test_legacy_stray_comma(self):
np.set_printoptions(legacy='1.13')
assert_equal(str(np.arange(10000)), '[ 0 1 2 ..., 9997 9998 9999]')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a try-finally, maybe? Or does this have cleanup?

@eric-wieser
eric-wieser merged commit 88f8310 into numpy:master Nov 29, 2017
@eric-wieser

Copy link
Copy Markdown
Member

Nevermind, all looks good. Thanks!

@lesteve

lesteve commented Dec 4, 2017

Copy link
Copy Markdown
Contributor

Thanks everyone! The scikit-learn doctests now pass on numpy master with legacy='1.13'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants