Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

names of all methods in class introspect pythonm

import weakref

class A:
    instances = []
    def __init__(self, name=None):
        self.__class__.instances.append(weakref.proxy(self))
        self.name = name

a1 = A('a1')
a2 = A('a2')
a3 = A('a3')
a4 = A('a4')

for instance in A.instances:
    print(instance.name)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #names #methods #class #introspect #pythonm
ADD COMMENT
Topic
Name
4+6 =