On this page
  1. inspect.getlineno
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

inspect.getlineno

Prev: inspect.getinnerframes | Up: inspect | Next: inspect.getmembers
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getlineno
Tags: #public #python3 #stdlib #inspect


Import

import inspect
from inspect import getlineno

Signature & Overview

inspect.getlineno(frame)

Get the line number from a frame object, allowing for optimization.

Usage

import inspect

line = inspect.getlineno(inspect.currentframe())
assert isinstance(line, int) and line > 0

Gotchas

REPL Inspect

from inspect import getlineno
help(getlineno)

Linked from

Related notes