In Cython as in Python is
is the object identity. It is not used for checking type.
You should write:
if isinstance(bar, A): ...
if you want to check if
bar
is of typeA
or any of its subtypeor
if type(bar) is A: ...
If you want to check is
bar
is exactly of typeA
.
Alternatively Cython
provide type checking via:
def foo(self, A bar):
which allows the user to pass also None
meaning no object. If you want to exclude None
write:
def foo(self, A bar not None):