Skip to main content
added 49 characters in body
Source Link
Bryan Oakley
  • 388.4k
  • 53
  • 582
  • 739

You can't make a classClasses are callable, you can only make instances callable. Whenin the sense that you "call" a class you are creatingto create an instance of the class. You call a class with the same syntax that you call functions, by using parenthesis and if you defineoptional arguments. This is unrelated to _call_call, that applies to the instance rather than the classwhich only affects instances.

You can't make a class callable, you can only make instances callable. When you "call" a class you are creating an instance, and if you define _call_, that applies to the instance rather than the class.

Classes are callable, only in the sense that you "call" a class to create an instance of the class. You call a class with the same syntax that you call functions, by using parenthesis and optional arguments. This is unrelated to call, which only affects instances.

Source Link
Bryan Oakley
  • 388.4k
  • 53
  • 582
  • 739

You can't make a class callable, you can only make instances callable. When you "call" a class you are creating an instance, and if you define _call_, that applies to the instance rather than the class.