0
How many args?
This __build_class__ function needs some amount of arguments, but it doesnât tell me how much it needs. It just says that there arenât enough arguments. How many arguments does this thing need? https://sololearn.com/compiler-playground/c7Ngiqy8N3Od/?ref=app
6 Answers
+ 3
It's an internal function that you would not normally modify. Just let it do it's own thing...
you could do
print(help(__build_class__))
to see what parameters it expects.
+ 2
"Whenever you define a class, the function __build_class__ is called behind the scenes. __build_class__ is passed the class code (which is actually, suprisingly, a function) and the class name as arguments."
https://sethdandridge.com/blog/defining-a-custom-class-constructor-in-JUMP_LINK__&&__python__&&__JUMP_LINK
+ 2
Bob_Li ,
Good idea. It's sparse but more than I found on python.org. I think the docstring has typos: an extra s and an unwanted line feed. I'm guessing *bases is a tuple of 0 or more parent classes. / means parameters to the left are positional.
help(__build_class__) # (print not needed)
Output:
Help on built-in function __build_class__ in module builtins:
__build_class
s__(...)
__build_class__(func, name, /, *bases, [metaclass], **kwds) -> class
Internal helper function used by the class statement.
0
New Game ,
I only found one instance of "__build_class__" on python.org.
https://peps.python.org/pep-0520/#changes
0
Rain
I canât think of a way you would use this function because I donât know what a metaclass is.
0
New Game ,
Let's find out.
These results are python.org pages that mention metaclass.
https://duckduckgo.com/?q=site%3Apython.org%20metaclass