Andrei Kulakov <andrei....@gmail.com> added the comment:

This would be problematic for two reasons:

 - possible confusion between the default function that runs when an argument 
doesn't match any registered types, and another "default" which runs when 
argument is omitted.

 - to see which function will run when argument is omitted, you would need to 
check in two places - the default value of arg and then find the registered 
function that matches it. If we end up deciding there is a need to run a 
default handler when an argument is omitted, it would be more explicit and 
convenient and visually obvious to decorate the "default if no arg" handler in 
some way, which also means there'd be a single place where this behavior is 
defined.

We can also consider adding a note to documentation that the first argument 
used for dispatch should not have a default value, to make it more explicit 
that dispatching on default value is not supported.

----------
nosy: +andrei.avk

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47030>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to