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

inspect.findsource

Prev: inspect.EndOfBlock | Up: inspect | Next: inspect.formatannotation
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.findsource
Tags: #public #python3 #stdlib #inspect


Import

import inspect
from inspect import findsource

Signature & Overview

inspect.findsource(object)

Return the entire source file and starting line number for an object.

Usage

import inspect
import json

lines, start_lineno = inspect.findsource(json.dumps)
assert isinstance(lines, list) and start_lineno >= 0

Gotchas

REPL Inspect

from inspect import findsource
help(findsource)

Linked from

Related notes