-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
MAINT: Removed supurious assert in histogram estimators #7193
Conversation
MAINT: Removed supurious assert in histogram estimators
Thanks @madphysicist . Should get rid of the |
Which |
Same function around dictionary access. Could check for key and raise proper error. |
Strictly speaking, the whole function should be removed, the methods made private functions, and the dictionary instantiated on module load. |
Isn't the |
Using |
Just so I understand, you mean doing |
Well, I'd just do |
I am not sure that using the exception is going to incurr any significant overhead. I have read in a number of places that Python exceptions are quite cheap that way, unlike say Java. However, I do have to agree that using |
This assert is superfluous. Both possible usages are already being handled:
histogram
. In this case it is always called in anif isinstance(bins, basestring):
block (Line 346 inmaster
)except KeyError:
block on Line 157 will handle the situation better than the assertion since it will not be optimized away and will actually deliver a useful message.