Skip to content

Instantly share code, notes, and snippets.

@belsander
Created December 11, 2016 15:54
Show Gist options
  • Save belsander/0a7bfcf785964e2683d70250f2812bd3 to your computer and use it in GitHub Desktop.
Save belsander/0a7bfcf785964e2683d70250f2812bd3 to your computer and use it in GitHub Desktop.
dir([object])
# Example
class test_class:
def __init__(self, test_property):
self.__test_property = test_property;
@property
def test_property(self):
return self.__property_value
@test_property.setter
def test_property(self, value):
self.__test_property = value;
def test_function(self):
print("Test Function")
class test_inner_class:
def __init__(self):
print("I'm empty")
>>> dir(test_class)
['__doc__', '__init__', '__module__', 'test_function', 'test_inner_class', 'test_property']
# '__doc__', '__init__' and '__module__' are always present in a class
# __doc__: string which is used for documentation
# __init__: constructor of the class
# __module__: name of the module the class was defined in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment