If I have this situation:
class Foo(object):
def __init__(self):
self.bar = Bar()
def do_something(self):
print 'doing something'
class Bar(object):
def __init(self):
self.a = 'a'
def some_function(self):
I want to call do_something function inside some_function function but this function doesn't belong to the class, what can I do to call this function? I don't want to use it with Foo().do_something, there are another option? I don't want to create new instance
another example:
class A(object):
def __init__(self):
self.content = 'abcdabcabcabc'
self.b = self.B()
self.c = self.C()
def some_function(self):
print self.content
class B(object):
def foo(self):
A.some_function()
class C(object):
def foo(self):
A.some_function()