Is there I way that I can annotate a function to ensure that an object being passed into the function has a certain method or attribute, but where I don't care about its actual type?
Pycharm internally uses a syntax that looks like {b} to indicate what methods/attributes it's inferred are required for the object, but that doesn't appear to be valid Python syntax:
def func(a: {b}): # Error
a.b = 1
Run Code Online (Sandbox Code Playgroud)
Is there a way to get the type …