OiO.lk Blog python How do I get methods with arguments in a Python class using dir() while keeping original order of methods?
python

How do I get methods with arguments in a Python class using dir() while keeping original order of methods?


The dir() method print the methods in alphabetical order. How can I keep the original order of the methods in my class?

Here’s my code

            return [(m, getattr(PythonClass, m).__code__.co_varnames)
                    for m in dir(PythonClass)]

Thanks!



You need to sign in to view this answers

Exit mobile version