Wrapping immutable objects - Graham Dumpleton
Briefly

Wrapping immutable objects - Graham Dumpleton
"The release has been delayed a bit as someone raised a number of questions about special Python dunder methods which the ObjectProxy class in wrapt didn't support. Some of these were omissions due to the fact that the special methods did not exist when wrapt was first implemented, nor were they a part of initial Python 3 versions when support was added for Python 3."
"An in-place operator in Python is an operator that modifies a variable directly without creating a new object. It combines an operation with assignment. In Python, in-place operators include: Obvious example of using an in-place operator is on integers. value = 1 value += 1 The result being that value ends up being set to 2. Other examples are tuples and lists:"
Wrapt 2.0.0 release was delayed because ObjectProxy lacked support for several Python special dunder methods. Some omissions occurred because those special methods did not exist when wrapt was first implemented or in early Python 3 versions. The __matmul__, __rmatmul__ and __imatmul__ methods that underpin matrix multiplication operators introduced in Python 3.5 were missing. Other dunder methods presented more complicated support questions. The ObjectProxy handling of in-place operator dunder methods revealed issues. In-place operators modify variables directly, combining an operation with assignment. Examples include integer, tuple and list operations and aliasing can produce differing results between immutable and mutable types.
Read at Grahamdumpleton
Unable to calculate read time
[
|
]