I am not sure if the title of the question is correct.
I am trying to achieve the following.
class A():
def __init__(self, name):
self.name = name
def foo1(self):
print(1, self.name)
def foo2(self):
print(2, self.name)
a1 = A('a1')
a1.foo1() # print '1, a1'
a2 = A('a2')
b = SomeFoo(a1, a2) # or, SomeFoo([a1, a2])
b.foo1() # calls a1.foo1(), a2.foo2()
Similarly,
b.foo2()
should call foo2
of both a1
and a2
. I guess np.vectorize
is something similar.
What would this potential SomeFoo
(class or function) be called?
And more importantly, what is a good way to write SomeFoo
?
Update
Replaced print
and printB
with foo1
and foo2
.