New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the best way for me to check if an object is attrs decorated class? #537
Comments
Check out |
That checks if the CLASS in an attrs decorated class. I tried this. `isinstance( obj, AttrsInstance )` but
This seems to keep if attr.has( obj.__class__ ) :
pass |
Actually Should the argument type be |
I suspect this might have been fixed by #997? |
Possibly. I'm using Debian 10 Buster, which has Python 3.7 installed and attrs Looks like a recent merge, so maybe the next attrs release will fix this. Will it fix it for older pythons too? |
according to #997 (comment) it should |
|
Say I have
Then how do I do something like
isinstance(obj, attrs)
to check if this class is attrs decorated?it seems by playing with it we have
is it always correct to use
'__attrs_attrs__' in dir(obj)
to check whether obj belongs to a attrs decorated class?The text was updated successfully, but these errors were encountered: