Special Method Protocols
__init__() — object lifecycle protocol
Initialize an already allocated instance after __new__. Do not return the instance or another value; a non-None return triggers TypeError during construction. The displayed signature is the concrete example contract; constructor or call parameters depend on the class.
Formal Syntax & Structure
python syntaxpython
def __init__(self, value):Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | object | Initial record value. |
Return Value
None
Initialization completes without a result.
Working Example
Example Snippetpython
class Record: def __init__(self, value): self.value = valueprint(Record(7).value)