You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Avoid union return types, since they require isinstance() checks. Use Any or X | Any if necessary."
I really don't think this is a good advise. In cases like this I'm inclined to use overloads, handle each case separately or separate functionality into separate methods/functions. I'm interested as to whether or not you think this should be changed?
The text was updated successfully, but these errors were encountered:
This advise mostly came out of typeshed where "separate functionality into separate methods" isn't an option (we can't change the stdlib). And overloads aren't always powerful enough either.
It would be useful though to recommend refactoring your code to avoid a Union return type if possible, or to use overloads where that makes sense.
In the typing docs https://typing.readthedocs.io/en/latest/source/stubs.html#types it states:
I really don't think this is a good advise. In cases like this I'm inclined to use overloads, handle each case separately or separate functionality into separate methods/functions. I'm interested as to whether or not you think this should be changed?
The text was updated successfully, but these errors were encountered: