Skip to content
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

Replace x[:] with x.copy() #14949

Merged
merged 1 commit into from Apr 24, 2023
Merged

Replace x[:] with x.copy() #14949

merged 1 commit into from Apr 24, 2023

Conversation

dosisod
Copy link
Contributor

@dosisod dosisod commented Mar 23, 2023

This PR fixes the FURB145 error code from Refurb. In my (limited) testing, using x.copy() is faster then both the interpreted and compiled versions of x[:] (see #14887 (comment)).

See #14887 for more info.

This PR fixes the [`FURB145`](https://github.com/dosisod/refurb/blob/master/docs/checks.md#furb145-no-slice-copy)
error code. In my (limited) testing using `.copy()` is faster then both
interpreted and compiled versions of `[:]` (see python#14887 (comment)).

See python#14887
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@ethanhs ethanhs left a comment

Choose a reason for hiding this comment

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

Looks good to me. Should there be micro-benchmarks added for this? Or perhaps an issue should be opened so mypyc can special case [:]? Both of those seem like they can be follow-up.

@sobolevn
Copy link
Member

I will go ahead and merge this ;)

@sobolevn sobolevn merged commit 186432d into python:master Apr 24, 2023
20 checks passed
@dosisod dosisod deleted the fix-furb145 branch April 25, 2023 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants