Skip to content

Instantly share code, notes, and snippets.

@solalatus
Created January 4, 2019 15:41
Show Gist options
  • Save solalatus/bd59ae03f34b599f2482da85d3ddfa2d to your computer and use it in GitHub Desktop.
Save solalatus/bd59ae03f34b599f2482da85d3ddfa2d to your computer and use it in GitHub Desktop.
class ABC():
def __init__(my_parameter):
self.my_object_variable = my_parameter
def whatever_shit():
print(self.my_object_variable)
def return_value():
return self.my_object_variable
class Xyz():
def __init__(my_parameter_holding_another_object):
self.my_object_variable = my_parameter_holding_another_object
def return_subobject_value():
return self.my_object_variable.return_value()
instance = ABC("this is the parameter")
instance.whatever_shit()
second_instance = Xyz(instance)
assert second_instance.return_subobject_value() == instance.return_value()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment