April 2014
Beginner to intermediate
634 pages
15h 22m
English
Generally, numbers are immutable. However, the numeric operators are also used for mutable objects. Lists and sets, for example, respond to a few of the defined augmented assignment operators. As an optimization, a class can include an in-place version of a selected operator. These methods implement the augmented assignment statements for mutable objects. Note that these methods are expected to end with return self to be compatible with ordinary assignment.
|
Method |
Operator |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|