MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / MyOtherObject

Class MyOtherObject

example_code/item_055.py:79–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78print("Example 5")
79class MyOtherObject:
80 def __init__(self):
81 self.__private_field = 71
82
83 @classmethod
84 def get_private_field_of_instance(cls, instance):
85 return instance.__private_field
86
87bar = MyOtherObject()
88assert MyOtherObject.get_private_field_of_instance(bar) == 71

Callers 1

item_055.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected