On this page
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
- Interactive exploration helper: Respects custom
__dir__(), and may omit dynamically computed__getattr__attributes.
REPL Inspect
help(dir)
Linked from
- tuts/python3/__builtins__
- tuts/python3/__builtins__/__builtins__
- tuts/python3/__builtins__/callable
- tuts/python3/__builtins__/delattr
- tuts/python3/__builtins__/dict
- tuts/python3/__builtins__/divmod
- tuts/python3/__builtins__/getattr
- tuts/python3/__builtins__/hasattr
- tuts/python3/__builtins__/hash
- tuts/python3/__builtins__/id
- tuts/python3/__builtins__/isinstance
- tuts/python3/__builtins__/issubclass
- tuts/python3/__builtins__/repr
- tuts/python3/__builtins__/setattr
- tuts/python3/__builtins__/vars
Related notes
- tuts/python3/__builtins__/__builtins__ Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/callable Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/delattr Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/dict Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/divmod Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/getattr Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/hasattr Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/hash Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__ links to this page; shared tags: #builtins
- tuts/python3/__builtins__/id links to this page; shared tags: #builtins