Performance of hasmethod vs try-catch on MethodError

I am not sure if someone pointed this out, but in some rare cases a method exists but throws MethodError explicitly. This is often done to give a better message to the MethodError exception. If you search the forum, you can see that sometimes this is done by the standard library and has caused confusion in the past.

1 Like