supporting named arguments #34
Replies: 5 comments
-
I think any linear scan of the registered functions is off the table, because it's so slow and Which reminds me of discussion #12, because another oddity about So it would look like: @multimethod
def f(foo):
pass
@multimethod
def f(foo: str):
return foo
f(foo="bar") |
Beta Was this translation helpful? Give feedback.
-
Another concern is that |
Beta Was this translation helpful? Give feedback.
-
Converting to a discussion since there's no clear path forward. |
Beta Was this translation helpful? Give feedback.
-
Added in 23589d3 to |
Beta Was this translation helpful? Give feedback.
-
See #98. |
Beta Was this translation helpful? Give feedback.
-
Right now this results in a dispatch error, because dispatch is based only on unnamed arguments:
Not a huge deal, but some people are rather particular about using named arguments whenever possible. Would this be possible to support?
This would complicate the dispatch algorithm, admittedly. You'd have to keep track of argument names for each overload and, accordingly, rearrange
*args
/**kwargs
inmultimethod.__call__()
. This could get a bit gross when accounting for argument names that are repeated or arranged in different orders for different overloads ...Beta Was this translation helpful? Give feedback.
All reactions