I ran this code
class A:
def __init__(self, func) -> None:
self.func = func
class B(A, int):
pass
b = B(lambda t: t)
and got this error:
TypeError Traceback (most recent call last)
Cell In[40], line 8
5 class B(A, int):
6 pass
----> 8 b = B(lambda t:t)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'function'
What is the cause of the error? An empty class instead of int works.
+)
class A:
def __init__(self, func) -> None:
self.func = func
class C:
def __init__(self, s) -> None:
assert type(s) == str
class B(A, C):
pass
b = B(lambda t: t)
this code works, so I am curious that what is special in int class, since the constructor never runs.