current scenario -
multiplication works for list, that is,
[1, 2] * 2
gives,
[1, 2, 1, 2]
but power does not work, that is,
[1, 2] ** 2
gives error,
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
I checked for all builtins, power only works on these,
defaultdict(<class 'set'>,
{'bool': {'int', 'float', 'complex', 'bool'},
'complex': {'int', 'float', 'complex', 'bool'},
'float': {'int', 'float', 'complex', 'bool'},
'int': {'int', 'float', 'complex', 'bool'}})
(means, int ** int, int ** float, int ** complex, int ** bool is valid)
expected scenario -
power works for list in the following way,
[1, 2] ** 0 -> [1, 2]
# it should be based on length of list, since there are two elements,
# so the below one is like, [1, 2] * (2 ** 1)
[1, 2] ** 1 -> [1, 2, 1, 2]
# [1, 2] * (2 ** 2), therefore repeated four times
[1, 2] ** 2 -> [1, 2, 1, 2, 1, 2, 1, 2]
similarly,
[1, 2, 3] ** 0 -> [1, 2, 3]
[1, 2, 3] ** 1 -> [1, 2, 3, 1, 2, 3, 1, 2, 3]
[1, 2, 3] ** 2 -> [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]