Linked Questions
42 questions linked to/from How do I get list of methods in a Python class?
0
votes
2
answers
953
views
How to read number of methods in a class in python? [duplicate]
As Python can have multiple classes in one file/module, then how to read Number of Methods class by class?
0
votes
0
answers
36
views
How do i list available datasets loaders in sklearn to see all list of available function [duplicate]
I am trying to list available datasets loaders after importing datasets module from sklearn to see a list of available function but it gives me an error :
from sklearn import datasets
datasets.load_
...
709
votes
22
answers
792k
views
Finding what methods a Python object has
Given a Python object of any kind, is there an easy way to get the list of all methods that this object has?
Or if this is not possible, is there at least an easy way to check if it has a particular ...
391
votes
30
answers
532k
views
How do I look inside a Python object?
I'm starting to code in various projects using Python (including Django web development and Panda3D game development).
To help me understand what's going on, I would like to basically 'look' inside ...
199
votes
8
answers
258k
views
How to enumerate an object's properties in Python? [duplicate]
I C# we do it through reflection. In Javascript it is simple as:
for(var propertyName in objectName)
var currentPropertyValue = objectName[propertyName];
How to do it in Python?
158
votes
14
answers
96k
views
Can a decorator of an instance method access the class?
I have something roughly like the following. Basically I need to access the class of an instance method from a decorator used upon the instance method in its definition.
def decorator(view):
# do ...
252
votes
5
answers
353k
views
How to get a complete list of object's methods and attributes? [duplicate]
dir(re.compile(pattern))
does not return pattern as one of the lists's elements. Namely it returns:
['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner', 'search', 'split', 'sub', '...
102
votes
5
answers
64k
views
How to decorate all functions of a class without typing it over and over for each method? [duplicate]
Lets say my class has many methods, and I want to apply my decorator on each one of them, later when I add new methods, I want the same decorator to be applied, but I don't want to write @mydecorator ...
29
votes
4
answers
44k
views
How can I list the methods in a Python 2.5 module?
I'm trying to use a Python library written in C that has no documentation of any kind. I want to use introspection to at least see what methods and classes are in the modules. Does somebody have a ...
20
votes
7
answers
45k
views
Run all functions in class
I am trying to run all the functions in my class without typing them out individually.
class Foo(object):
def __init__(self,a,b):
self.a = a
self.b=b
def bar(self):
...
24
votes
5
answers
24k
views
How Do I Perform Introspection on an Object in Python 2.x?
I'm using Python 2.x and I have an object I'm summoning from the aether; the documentation on it is not particularly clear. I would like to be able to get a list of properties for that object and the ...
9
votes
3
answers
10k
views
How to dynamically create module level functions from methods in a class
I am trying to dynamically create module level functions from the methods in a class. So for every method in a class, I want to create a function with the same name which creates an instance of the ...
10
votes
4
answers
4k
views
Separating class definition and implementation in python
I am a Python beginner and my main language is C++. You know in C++, it is very common to separate the definition and implementation of a class. (How) Does Python do that? If not, how to I get a clean ...
4
votes
4
answers
6k
views
Looping over a Python / IronPython Object Methods
What is the proper way to loop over a Python object's methods and call them?
Given the object:
class SomeTest():
def something1(self):
print "something 1"
def something2(self):
print "...
4
votes
1
answer
3k
views
Finding out which functions are available from a class instance in python?
How do you dynamically find out which functions have been defined from an instance of a class?
For example:
class A(object):
def methodA(self, intA=1):
pass
def methodB(self, strB):
...