Treating str as not Iterable/Sequence[str] #8222
AlexeyDmitriev
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Yes, this has been discussed before. I'd prefer to solve this problem in the Python typing spec and/or typeshed stubs rather than hard coding a non-standard exception. Doing so creates problems, especially when different type checkers deviate in their handling. I don't think the typing community has reached a consensus on a solution. The python typing forum is a good place to discuss this. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I understand that in the language str can be iterated and return strings.
However, in my experience most of the time somebody writes
they expect
f("abc")
to be rejected.Have you thought making this an error in pyright? (maybe under feature flag)
As far as I understand, another type checker (pytype) went this way and they were happy about the result
Beta Was this translation helpful? Give feedback.
All reactions