fix(curriculum): explain callable() in dynamic attributes lecture (#67360)

This commit is contained in:
Hritik Kaushik
2026-05-14 18:09:29 +05:30
committed by GitHub
parent bb616d1405
commit 78f7675253
@@ -97,6 +97,8 @@ for attr in dir(person):
# name: John Doe
```
In the loop above, `callable()` is a built-in function that returns `True` if the object passed to it can be called like a function or method, and `False` otherwise. By checking `not callable(getattr(person, attr))`, the loop skips over methods and only prints the data attributes like `name` and `age`.
The `setattr()` function lets you create a new attribute or update an existing one dynamically. The syntax looks like this:
```python