Mar-13-2022, 12:20 AM
Try these two functions I made to help you understand
This may help you understand.
def is_dunder(property): return True if property[:2] == '__' else False def print_properties(obj): [print(prop) for prop in dir(obj) if not is_dunder(prop)]Create your instances in the repl
BA
and time_instance
in your case and pass them to print_properties()
to see what sorts of properties each instance has. To explain the code, its simple is_dunder
simply checks the first two characters of property to see if they are '__' and returns a boolean. print_properties(obj)
takes a instance object and prints each of the properties if they are not dunders.This may help you understand.
Apologetic Canadian, Sorry about that eh?