0

I am looking for the name of the process where you call a function using param=. For example:

class Test:
    def __init__():
        pass

    def testing(arg1):
        return solution = arg1 + arg1

t = Test()
t.testing(arg1=4)

What is the process called used in the last line where I explicit set each param manually?

  • 1
    Are you referring to "keyword arguments"? – Iain Shelvington Jun 29 '22 at 03:47
  • As an aside, the code shown here is broken (`=` cannot be part of an expression, and even with `:=`, parentheses would be required, and it would also be pointless in a `return` statement), and there is no reason to use a class here. (Also, that's *explicit*, not implicit.) – Karl Knechtel Jun 29 '22 at 03:49
  • Side-note: This code is syntactically invalid (you can't use an assignment statement inside a `return` statement) and illegal in other ways (`t.testing(arg1=4)` will pass a `self` argument implicitly, and `testing` doesn't accept it). – ShadowRanger Jun 29 '22 at 03:50
  • ShadowRanger : You are correct, I quickly wrote the code. Thank you! @Karl Knechtel : I learned about classes today and felt cool so I wrote it this way but understood. Ian Shelvinton Yes, this is what I couldn't remember – Damien Scoff Jun 29 '22 at 03:55

0 Answers0