June 2019
Beginner to intermediate
770 pages
19h 24m
English
By default, any class we create will permit the following four behaviors with respect to attributes:
We can experiment with this using something as simple as the following code. We can create a simple, generic class and an object of that class:
>>> class Generic: ... pass ... >>> g = Generic()
The preceding code permits us to create, get, set, and delete attributes. We can easily create and get an attribute. The following are some examples:
>>> g.attribute = "value" >>> g.attribute 'value' >>> g.unset Traceback (most recent call last): File "<stdin>", line 1, in <module> ...
Read now
Unlock full access