I have various classes Class1, Class2, Class3, etc. all of which contain this exact piece of content inside:
def showName(self):
openWindow()
print self.name
For example:
class Class1:
# SOME CODE
def showName(self):
openWindow()
print self.name
# SOME MORE CODE
What is the best way to have showName defined once in a separate file and import it back to Class1, Class2, Class3, etc.?
Derive from this mixin:
Or make it a separate function, in case you intend
nameto be a public member.