Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Интересный Python - Вопрос 1
print('look carefully for object identities') print('\ndefine Inner') class Inner: def __init__(self): print('Inner.__init__(', self, ')') def __del__(self): print('Inner.__del__(', self, ')') print('\ndefine Outer') class Outer: class_attribute = Inner() def __init__(self): print('Outer.__init__(', self, ')') self.instance_attribute = Inner() def __del__(self): print('Outer.__del__(', self, ')') print('\ncreate OuterInstanceA') OuterInstanceA = Outer() print('\ncreate OuterInstanceB') OuterInstanceB = Outer() print('\nOuterInstanceA.class_attribute ::', OuterInstanceA.class_attribute) print('OuterInstanceA.instance_attribute ::', OuterInstanceA.instance_attribute) print('OuterInstanceB.class_attribute ::', OuterInstanceB.class_attribute) print('OuterInstanceB.instance_attribute ::', OuterInstanceB.instance_attribute) print('Outer.class_attribute ::', Outer.class_attribute) try: print('Outer.instance_attribute ::', Outer.instance_attribute) except Exception as e: print('Outer.instance_attribute !', e) print('\ndelete OuterInstanceA') del OuterInstanceA print('\ndelete OuterInstanceB') del OuterInstanceB print('\ndelete Outer') del Outer print('\nend')
run
|
edit
|
history
|
help
0
Lab_I_1_25_11_2020
inverse matrix gauss jordan
Tupples
Venture
square cube function
Python mehrfachvererbung
LinkedNode and its use in Stack and Queue implementation
bubbleSort.py
(P3) Hamming 1
fibonacci sequence generator and golden ratio