Skip to content

Instantly share code, notes, and snippets.

@TimurNurlygayanov
Last active January 21, 2019 14:16
Show Gist options
  • Save TimurNurlygayanov/43cb8e44b45bc7dd7e5bdfc1ce470565 to your computer and use it in GitHub Desktop.
Save TimurNurlygayanov/43cb8e44b45bc7dd7e5bdfc1ce470565 to your computer and use it in GitHub Desktop.
parent_and_child_python
class a(object):
my_attr = 'simple attribute'
_my_attr2 = 'internal attribute'
__my_attr3 = 'real internal attribute'
# Magic here: ['_a__my_attr3', '_my_attr2', 'my_attr']
print([name for name in dir(a) if 'my_attr' in name])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment