Error in multiple dispatch

Hi,
in super short: Multiple dispatch does not work for keyword arguments, see also Using Multiple Dispatch with Keyword Arguments

What I assume is happening here is, that you second definition is not an additional one, but it redefines (hence replaces) the zero-argument constructor If you switch both definitions, the float one will work, the quantity one will not.

You could use positional arguments instead

2 Likes