Closed elichai closed 4 years ago
It's possible. There's a __mul__()
method and an __rmul__()
(and similar 'r' methods for other operations). In fact, I overloaded __radd__()
for the special case of 0
so that the sum()
built-in function would work: https://github.com/bitcoinops/taproot-workshop/blob/b6d40e52095a83eb9d8a01097edabe1f2c0fe180/test_framework/key.py#L381. We could easily extend this for the more general case.
I'm not sure if it's possible in python. but it's weird that
5*key
doesn't work butkey*5
does.