Runtime Data Attributes
type.__firstlineno__
Python 3.13 class source start line, including decorators. Not available on every type; assigning __module__ removes the class dictionary entry.
Formal Syntax & Structure
python syntaxpython
Cls.__firstlineno__Return Value
int
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
ns = {}exec(compile('\n\nclass C: pass','<demo>','exec'),ns)C = ns['C']print(C.__firstlineno__)