[BUG] Default arguments are not supported with Dispatch (regression from 0.2.5)
See original GitHub issueThis was working in 0.2.5,
import plum
from plum import dispatch
@dispatch
def test(a:int, b: int = 1):
print('int, int')
@dispatch
def test(a:float, b: int = 1):
print('float, int')
In [33]:
In [33]: test(1,1)
---------------------------------------------------------------------------
NotFoundLookupError Traceback (most recent call last)
<ipython-input-33-9b86683066a3> in <module>
----> 1 test(1,1)
~/Documents/pythonenvs/netket_env/lib64/python3.8/site-packages/plum/function.cpython-38-x86_64-linux-gnu.so in plum.function.Function.__call__()
~/Documents/pythonenvs/netket_env/lib64/python3.8/site-packages/plum/function.cpython-38-x86_64-linux-gnu.so in plum.function.Function.resolve_method()
~/Documents/pythonenvs/netket_env/lib64/python3.8/site-packages/plum/function.cpython-38-x86_64-linux-gnu.so in plum.function.Function.resolve_signature()
NotFoundLookupError: For function "test", signature Signature(builtins.int, builtins.int) could not be resolved.
In [34]: test(1)
int, int
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
dispatch behavior of optional arguments · Issue #7357 - GitHub
I think it's ultimately a good thing that default arguments are not a special feature, and just reduce to dispatch.
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
(was: =dev-java/jdbm-1.0 is available)" status:RESOLVED resolution:OBSOLETE severity:enhancement · Bug:107027 - "dev-vcs/cvsd init script for is not ...
Read more >Bug #9593: Keyword arguments default argument assignment ...
Personally, I prefer 2.0.0 behaviour, but the way 2.1.1 handles default arguments in non keyword arguments is inconsistent.
Read more >Bioconductor 3.11 Released
It supports pseudotemporal ordering algorithms and visualization ... This does not affect default prior, only empirical Bayes approach.
Read more >"Least Astonishment" and the Mutable Default Argument
Actually, this is not a design flaw, and it is not because of internals or performance. It comes simply from the fact that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’re right. That seems like a relatively easy and handy feature. Actual keyword arguments should then be specified using
*
:Hey guys!
Just letting you know that I’m a little busy at the moment, but I hope to get to this in the near future.