Skip to content

MAINT: Simplify _leading_trailing - #10130

Merged
mhvk merged 1 commit into
numpy:masterfrom
eric-wieser:tidy-_leading_trailing
Nov 30, 2017
Merged

mhvk merged 1 commit into
numpy:masterfrom
eric-wieser:tidy-_leading_trailing

Conversation

@eric-wieser

Copy link
Copy Markdown
Member

Removes the list comprehensions in favor of numpy primitives.
Now recurses over the indices, not the values.

Split from #10123.

Comment thread numpy/core/arrayprint.py Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a bug (it ignored the kwarg to array2string), but I want to leave that to another PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably good to put up a separate issue for it (if you haven't done so already) or link to a PR. (I'm only arguing from knowing my state of memory -- I'd forget...)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think @ahaldane already approved this more or less, and I think it looks good too, with one suggestion.

Comment thread numpy/core/arrayprint.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That , at the end really threw me of: I'd either use np.index_exp[:edgeitems] (which always returns a tuple), or go for the, for me, more natural (slice(None, edgeitems),)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

s_ is slightly faster, but I guess we don't care. I'll switch to index_exp

Removes the list comprehensions in favor of numpy primitives.
Now recurses over the indices, not the values.

@ahaldane ahaldane left a comment

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.

LGTM

@mhvk

mhvk commented Nov 30, 2017

Copy link
Copy Markdown
Contributor

OK, tests passed and approved twice, so merging.

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