Question from a "java background" developer
David Lowry-Duda
david at lowryduda.com
Tue Sep 22 21:02:37 EDT 2020
On Tue, Sep 22, 2020 at 11:13:50AM +0200, Agnese Camellini wrote:
> I mean do i have a keyword to obtain all the methods and the
> attributes of
> a class in python?
In addition to the `dir()` that others have mentioned, I'll add that
developing interactively is very common, especially in ipython/jupyter
sessions or notebooks. With these, you have tab completion or question
mark documentation.
For example, if you have an instance `myobj` of the class `MyClass`,
then in an ipython session, typing `myobj.<tab>` will open up a list of
all the methods for objects of `MyClass`. And given an object or
funcation, appending `?` will bring up the documentation (as given in
the docstring) for that object or function. This is true even for
user-defined functions and objects, even if they were defined during the
same interactive session.
Good luck!
--
David Lowry-Duda <david at lowryduda.com> <davidlowryduda.com>
More information about the Python-list
mailing list