In 18 class def __init__ self self def pr self return self In 23 In 24

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
In [18]: class a:
def __init__(self):
self.a = 2
def pr(self):
return self.a
....:
....:
In [23]:
In [24]: a
Out[24]: <class __main__.a at 0x88982cc>
In [25]: instance = a()
In [26]: print getattr(locals()['a'], 'pr')(locals()['instance'])
-------> print(getattr(locals()['a'], 'pr')(locals()['instance']))
2
In [27]: