-
Notifications
You must be signed in to change notification settings - Fork 152
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
furl doesn't type-hint itself as Text #146
Comments
this would be handy indeed. all for this improvement digging in, what other side effects might subclassing |
For one, And also maybe typing covariance/contravariance issues? I've since taken out my "workaround" above and posited changes from the other side, in |
exactly as i was curious about 🙂
sounds good. fwiw, furl does this, too, by testing if an object has def attemptstr(o):
try:
return str(o)
except Exception:
return o either way, shall we close this issue? |
If
furl
were atyping.Text
, it would work with static type checkers/hinters.I like that the following works:
However, the static checker (I'm using PyRight) complains that
furl.furl.furl
does not matchrequest.post
's signature forText | bytes
.I'm newish to Python still, but I think it would require adding the superclass:
Then using a factory function named
furl
.In the meantime, this is my workaround to satisfy the checker:
The text was updated successfully, but these errors were encountered: