On this page
  1. inspect.Attribute
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

inspect.Attribute

Prev: inspect.Arguments | Up: inspect | Next: inspect.BlockFinder
Rel: inspect.ArgInfo, inspect.Arguments, inspect.BlockFinder, inspect.BoundArguments
Ref: docs.python.org โ€” inspect.Attribute
Tags: #public #python3 #stdlib #inspect


Import

import inspect
from inspect import Attribute

Signature & Overview

inspect.Attribute(name, kind, defining_class, object)

Attribute(name, kind, defining_class, object)

Methods & Attributes

Usage

import inspect

class Demo:
    x = 1
    def m(self): pass

attrs = {a.name: a for a in inspect.classify_class_attrs(Demo)}
assert isinstance(attrs["m"], inspect.Attribute) and attrs["m"].kind == "method"

Gotchas

REPL Inspect

from inspect import Attribute
help(Attribute)

Linked from

Related notes