filmov
tv
Making a read only attribute in Python

Показать описание
If you need to make a read-only attribute in Python, you can turn your attribute into a property that delegates to an attribute with almost the same name (but with an underscore prefix).
00:00 A property is like an auto-updating attribute
00:42 Properties can make read-only attributes
01:55 Using an underscore prefix for internal attributes
02:34 The single underscore prefix is just a convention
03:12 The property decorator can make a read-only attribute
00:00 A property is like an auto-updating attribute
00:42 Properties can make read-only attributes
01:55 Using an underscore prefix for internal attributes
02:34 The single underscore prefix is just a convention
03:12 The property decorator can make a read-only attribute