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

dir

Prev: dict | Up: __builtins__ | Next: divmod
Rel: callable, delattr, getattr, hasattr, hash
Ref: docs.python.org — dir
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import dir

Overview & Signature

dir([object]) -> list of strings

If called without an argument, return the names in the current scope.

Usage

names = dir("hello")
assert "upper" in names and "startswith" in names

Gotchas

REPL Inspect

help(dir)

Linked from

Related notes