full works on lists but with very bad performance
See original GitHub issueWhen you pass a python list to full, it actually works as expected but with bad performance. The documentation says that only a scalar is accepted, but because it does the right thing, it’s very easy for people to end up with code like this that’s correct but inefficient.
import numpy
x = numpy.full(100, range(100))
The reason it’s inefficient is because the source looks like this:
if dtype is None:
dtype = array(fill_value).dtype
a = empty(shape, dtype, order)
multiarray.copyto(a, fill_value, casting='unsafe')
return a
If the dtype is not specified, the branch actually creates a copy of the whole array, throws it away, and then does it again.
I would suggest either explicitly supporting this use case, and improving performance and docs to match. Or, try to do some kind of basic check to reject this input as unacceptable.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
11 Tips for Talking About Poor Performance - SHRM
Difficult conversations sometimes are inevitable. Don't make them harder than they have to be.
Read more >7 Causes of Poor Employee Performance - LinkedIn
If an employee seems bored or burned out, it's the manager's job to try to help reenergize him. Being burned out is not...
Read more >What to Do After a Bad Performance Review
Here's how to bounce back from a negative review. Reflect before you react. It's tempting to get angry or defensive, especially if you're ......
Read more >How To Deal With Poor Employee Performance
The first is to understand the reason and judge if they're genuine or not. Even if they're not, do not let the other...
Read more >Performance of Arrays vs. Lists - Stack Overflow
A prepend operation is just an insert at 0. It's the worst case insert in terms of performance, so if insert is slow,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks all for the help, @eric-wieser I just created a new branch and did the changes again since it was such a small change.
Ah thank you! Just pulled the trigger on that. Apologies for the hold up, I’m new to this workflow and thought I was done after simply doing a commit.