bt2: value.py: numeric classes: remove __i*__ operators
Those operators do a binary operation to a value object and another
operand, and then set the result as the value object's value.
Now that I think about it, it is weird to do something like:
a = bt2.UnsignedIntegerValue(23)
a += 17.5
and that the value of `a` becomes 40. This is not a problem for a native
Python object because `a` does not name the same object after the
operation:
a = 23
type(a) # int
id(a) #
140669243488160
a += 17.5
type(a) # float
id(a) #
140669043054920
but we can't do this with our value object: this is internal Python's
magic.
So I believe we should be more strict. But this means you can't do:
a = bt2.UnsignedIntegerValue(23)
a += 17.5
anymore (a `TypeError` exception would be raised).
This means a lot of specific automatically injected tests must
conditionally exist (depending on whether or not the test is possible
with the two operands, whereas it's always possible now).
Instead of doing this work, I choose to completely remove the support
for "self" operators. We can add useful ones in the future when we have
time, but I don't even think they are super useful: because a value
object becomes conceptually frozen as soon as you use it somehow,
there's no point in doing `+=`, `-=`, `**=`, `<<=`, and so on. For those
rare cases, you can always do:
a = bt2.UnsignedIntegerValue(23)
a = a + 17
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icd5f0a9d0232c2f7ba91133561235fec7526083b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1566
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>