-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Add helpers.math._factorize #6360
Conversation
I learned a bitwise OR ( |
Thanks for taking a look. I've added input validation per your suggestion |
Thank you, but I think it would be enough to return an empty array and checking that. |
If we return an empty array then it will be much harder to figure out why the code is not working as expected. We should never encounter a non-positive integer as input. If we do then I want to know as soon as possible so that I can find the bug causing the bad input rather than hiding the error and making it harder to find what's going wrong. Here's a detailed article about the concept: https://www.martinfowler.com/ieeeSoftware/failFast.pdf |
That's true. However, it is an internal method and not supposed to be used by users. I feel it's too much to check and throw an error in it. |
@nagix I had another idea. What if I return an empty array, but log a warning with |
I do agree I don't think adding |
Ok. I've gone ahead and removed. Thanks again for taking a look at this |
* Add helpers.math._factorize * Remove duplicate test statement
This is splitting off part of #6274 to make that PR smaller and easier to review. I plan to reopen that PR soon
By exporting this as part of
helpers.math
I'm able to add tests for this method and it also helps organize the code. Thehelpers.math
file is also being added in #6343 in order to add ahelpers.math.log10