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

delattr

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


Import & Availability

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

Overview & Signature

delattr(obj, name, /)

Deletes the named attribute from the given object.

Usage

class Obj: pass
o = Obj()
o.temp = 123
delattr(o, "temp")
assert not hasattr(o, "temp")

Gotchas

REPL Inspect

help(delattr)

Linked from

Related notes