access to all class attributes by getattr | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

access to all class attributes by getattr

Is there anything to assign as a second argument of getattr() and get access to all of class attributes?

25th Feb 2022, 4:29 PM
shokin touch
1 Resposta
0
That's not what the function is for. There is the dir function that returns a list of all properties. But that one will also include functions and built-in properties. You could use that and try to filter away what you don't think is an attribute. The built-in properties have have "__" in the beginning and end. You can identify and filter them. The problem is the functions.
26th Feb 2022, 8:57 AM
Mustafa A
Mustafa A - avatar