Skip to content

Instantly share code, notes, and snippets.

@elben
Created April 20, 2010 05:09
Show Gist options
  • Save elben/372062 to your computer and use it in GitHub Desktop.
Save elben/372062 to your computer and use it in GitHub Desktop.
class Clown(object):
def __init__(self, name):
self.name = name
def nice_hi(self):
return "Helloooo " + self.__format_name()
def __format_name(self): # mangled to _Clown__format_name()
return self.name + " (the clown)"
class ScaryClown(Clown):
def __init__(self, name):
Clown.__init__(self, name)
def __format_name(self): # mangled to _ScaryClown__format_name()
return self.name + " (the scary clown)"
c = ScaryClown("Billy")
print c.nice_hi() # Helloooo Billy (the clown)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment