meta data for this page
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
programming:python:oop [2023/12/14 09:48] – created niziak | programming:python:oop [2024/01/03 11:34] (current) – niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== OOP ====== | ====== OOP ====== | ||
+ | |||
+ | ===== special methods ===== | ||
+ | [[https:// | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * It is not guaranteed that __del__() methods are called for objects that still exist when the interpreter exits. | ||
+ | * **Note**: '' | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ===== call super constructor ===== | ||
+ | <code python> | ||
+ | class A(object): | ||
+ | def __init__(self): | ||
+ | print(" | ||
+ | |||
+ | class B(A): | ||
+ | def __init__(self): | ||
+ | print(" | ||
+ | super().__init__() | ||
+ | </ | ||
===== singletons ===== | ===== singletons ===== | ||
Line 24: | Line 52: | ||
</ | </ | ||
+ | |||
+ | ===== attributes / properties ===== | ||
+ | |||
+ | * **attribute** - direct access to data member of object | ||
+ | * **property** - properties are methods accessed like attributes. It gives full control on its getter, setter and deleter access. | ||
+ | |||
+ | |||
+ | **delattr(object, | ||
+ | This is a relative of '' | ||
+ | |||
+ | |||
+ | ===== Object-like attribute access for nested dictionary ===== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||