akuli@akuli-desktop:/tmp$ cat asd.py
class Foo:
def __index__(self):
return 1
akuli@akuli-desktop:/tmp$ python3.7 -c 'import math, asd; math.sin(asd.Foo())'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: must be real number, not Foo
akuli@akuli-desktop:/tmp$ python3.8 -c 'import math, asd; math.sin(asd.Foo())'
akuli@akuli-desktop:/tmp$