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
{{ message }}
Repository navigation
Possible to distinguish between Sequence[str]/Iterable[str] and str? #1965
If a function expects an iterable of strings, is it possible to forbid passing in a string, since strings are iterable? Seems like there are many cases where this would be an error, but I don't see an obvious way to check 't','h','i','s'.
changed the title [-]Possible to distinguish between Iterable[str] and str?[/-][+]Possible to distinguish between Sequence[str]/Iterable[str] and str?[/+]on Jul 29, 2016
Activity
[-]Possible to distinguish between Iterable[str] and str?[/-][+]Possible to distinguish between Sequence[str]/Iterable[str] and str?[/+]gvanrossum commentedon Jul 29, 2016
The PEP 484 type system currently can't express this, sorry. You'll have to start a discussion in the PEP 484 tracker: https://github.com/python/typing/