- 1
Python
Please I need help with the explanation and examples on how to make a function accepts a class object as the function attributes eg def function(classobj, classobj)
7 odpowiedzi
+ 1
What about this :
def func(anyclass=class):
obj=anyclass()
So if you provided another class it will be used, and if not the default class will be used.
+ 1
Look at this at might help
https://stackoverflow.com/questions/4501403/class-as-an-input-in-a-function
0
Maybe you can set it as default parameters
def func(x = class()):
0
What if I'm using it for different classes
0
Abdullah
So u want your function to accept a value and a class as a parameters?
0
Just accept a class object
Let's say I have more than one classes and I want a function to use those classes to perform operations
0
Let me try working with this thanks a lot