You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that several exceptions are caught in order to return None, but I wonder if it might be possible to let the exception bubble up to the top instead. For example, in the case of trying to find the square root of a negative number, math.sqrt throws a ValueError, and it might be best to allow that exception to rise to the top of the code.
The text was updated successfully, but these errors were encountered:
Yes, the present approach could be improved. I think we can add some code to test input parameter for each function, then throw out the much more precise message. For sqrt, return complex number when the input is negative would be nice. The returned None is just for the case of dealing with a large script, we can use is None or not to control the flow.
The issue of sqrt with negative is resolved by printing out a warning message (a3a1a4b), rather than throw out an exception, and the returned value is None. The same case for pyrpn command line interface, the invalid input will not stop the session.
I see that several exceptions are caught in order to return None, but I wonder if it might be possible to let the exception bubble up to the top instead. For example, in the case of trying to find the square root of a negative number, math.sqrt throws a ValueError, and it might be best to allow that exception to rise to the top of the code.
The text was updated successfully, but these errors were encountered: