Runtime Data Attributes
code.co_firstlineno
Starting source line recorded for the code object. It is not the current instruction line; use frame or traceback metadata for that.
Formal Syntax & Structure
python syntaxpython
code.co_firstlinenoReturn Value
int
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
ns = {}exec(compile('\n\ndef f(): return 1','<demo>','exec'),ns)code = ns['f'].__code__print(code.co_firstlineno)