-
Hello! Sorry, it's me again! 😅 Is there any way to implement a variable number of positional arguments, like in the following example: from multimethod import multimethod
@multimethod
def call():
print("Hello, world!")
@multimethod
def call(name):
print(f"Hello, {name}!")
call() # Hello, world!
call("Foo") # Hello, Foo! Thank you kindly for the help, and sorry again for the multiple issues! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
def call(name="world"):
print(f"Hello, {name}!") |
Beta Was this translation helpful? Give feedback.
-
Actually, speaking of which, how do you use |
Beta Was this translation helpful? Give feedback.
multimethod
supports variable arguments, but there are no types in the example. The pythonic way to do this kind of "overloading" is to use defaults.