class & instance dictionaries in Python | __dict__ | OOP - Part 2

preview_player
Показать описание
We look into the class and instance dictionaries in Python, covering getattr, setattr, delattr, attribute lookup order etc...

0:00 Class dictionary
1:15 Doc string attribute
1:33 The "dot" syntax
2:02 vars function
2:09 getattr, setattr, delattr
3:15 Instance dictionary
4:08 Attribute lookup order

Рекомендации по теме
Комментарии
Автор

Thank you so much. Really appreciate your work.

dahomosapien
Автор

Like! Thank you for using simple English! No tricky words.

mishkasensei
Автор

The content is actually great, thank you

alijvn
Автор

great but sound is only coming from left

yt-
Автор

@sreekanthpr Nice content as always. At 4:48: "...you cannot modify the class attributes through objects directly" - in fact, you can, if class attribute is an object of mutable type. For example:

>>> class A: somelist = [1, 2, 3]
>>> a1, a2 = A(), A()
>>> a1.somelist.append(4)
>>> a1.somelist # Will print [1, 2, 3, 4]
>>> a2.somelist # Will print [1, 2, 3, 4]
>>> A.somelist # Will print [1, 2, 3, 4]

k
visit shbcf.ru