0
class Test:
    def test_fun(self, a=0, b=0):
        # code

Is there a way to check if test_fun has no arguments given, test_fun(), without comparing if a==0 and if b==0?

Angelo
  • 97
  • 7
  • Why would you want to do that? Doesn't that defeat the purpose of having default values? – rdas May 09 '19 at 21:21
  • You could maybe use `kwargs` and check the length of `kwargs`. @rdas there are some built-in functions (e.g. `range()`) that behave differently depending on whether one argument is given or whether two or more are. Maybe look at the internals and see how `range()` implements it and copy that design pattern? – Green Cloak Guy May 09 '19 at 21:24

0 Answers0