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
Right now, most of our optimizers use the assertions() method to catch invalid inputs. This method is implemented in a Look Before You Leap (LBYL) fashion. However, idiomatic Python is often written in an Easy to Ask Forgiveness than Permission (EAFP) design, so it's better to catch errors using that.
This also removes the need to be very strict with the types passed in bounds or velocity_clamp. We usually require a tuple of lists, but in reality, an iterable should suffice, please check those conditions when dealing with this issue.
My idea is to delegate error handling in the backend, rather than having an assertions() method for each optimizer. Perhaps, it might even be better to have an assertionsmodule and do all checks there. Hopefully, this would make our implementation much cleaner.
The text was updated successfully, but these errors were encountered:
Right now, most of our optimizers use the
assertions()
method to catch invalid inputs. This method is implemented in a Look Before You Leap (LBYL) fashion. However, idiomatic Python is often written in an Easy to Ask Forgiveness than Permission (EAFP) design, so it's better to catch errors using that.This also removes the need to be very strict with the types passed in
bounds
orvelocity_clamp
. We usually require atuple
oflists
, but in reality, aniterable
should suffice, please check those conditions when dealing with this issue.My idea is to delegate error handling in the backend, rather than having an
assertions()
method for each optimizer. Perhaps, it might even be better to have anassertions
module and do all checks there. Hopefully, this would make our implementation much cleaner.The text was updated successfully, but these errors were encountered: