From 05ea5c02dcfe502919b3ef1bc5539c5acfcaeb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 29 Apr 2021 03:51:37 +0200 Subject: [PATCH] Introspection --- README.md | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ecd876a..983d8d2 100644 --- a/README.md +++ b/README.md @@ -2141,8 +2141,8 @@ Introspection ### Attributes ```python = dir() # Names of object's attributes (incl. methods). - = vars() # Dict of object's fields. Also .__dict__. - = hasattr(, '') # Checks if getattr() raises an error. + = vars() # Dict of writable attrs. Also .__dict__. + = hasattr(, '') # Checks if getattr() raises an AttributeError. value = getattr(, '') # Raises AttributeError if attribute is missing. setattr(, '', value) # Only works on objects with __dict__ attribute. delattr(, '') # Equivalent to `del .`. diff --git a/index.html b/index.html index d7e629b..55df028 100644 --- a/index.html +++ b/index.html @@ -1905,8 +1905,8 @@ last_el = op.methodcaller('pop')(<l

Attributes

<list> = dir(<object>)                     # Names of object's attributes (incl. methods).
-<dict> = vars(<object>)                    # Dict of object's fields. Also <obj>.__dict__.
-<bool> = hasattr(<object>, '<attr_name>')  # Checks if getattr() raises an error.
+<dict> = vars(<object>)                    # Dict of writable attrs. Also <obj>.__dict__.
+<bool> = hasattr(<object>, '<attr_name>')  # Checks if getattr() raises an AttributeError.
 value  = getattr(<object>, '<attr_name>')  # Raises AttributeError if attribute is missing.
 setattr(<object>, '<attr_name>', value)    # Only works on objects with __dict__ attribute.
 delattr(<object>, '<attr_name>')           # Equivalent to `del <object>.<attr_name>`.