Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created December 21, 2019 15:58
Show Gist options
  • Save FerdinaKusumah/15da4233e18410900b923b486a212e9b to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/15da4233e18410900b923b486a212e9b to your computer and use it in GitHub Desktop.
Underscore Python
class ExtendedSample(Sample):
def __init__(self):
super().__init__()
self.a = 'overridden'
self._b = 'overridden'
self.__c = 'overridden'
>>> t2 = ExtendedSample()
>>> t2.a
'overridden'
>>> t2._b
'overridden'
>>> t2.__c
AttributeError: "'ExtendedSample' object has no attribute '__c'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment