Created
October 26, 2018 21:30
-
-
Save jessamynsmith/1245520bbcd87477304891c68717c4da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class MyClass: | |
... """ hello """ | |
... attr1 = 'hello' | |
... attr2 = 23 | |
... | |
... def method1(self): | |
... return self.attr1 | |
... | |
... def __str__(self): | |
... return '{} {}'.format(attr1, attr2) | |
... | |
>>> my_obj = MyClass() | |
>>> | |
>>> for item in dir(my_obj): | |
... print(item, type(getattr(my_obj, item))) | |
... | |
('__doc__', <type 'str'>) | |
('__module__', <type 'str'>) | |
('__str__', <type 'instancemethod'>) | |
('attr1', <type 'str'>) | |
('attr2', <type 'int'>) | |
('method1', <type 'instancemethod'>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment