Skip to content
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

Possible to distinguish between Sequence[str]/Iterable[str] and str? #1965

Closed
jtatum opened this issue Jul 29, 2016 · 1 comment
Closed

Possible to distinguish between Sequence[str]/Iterable[str] and str? #1965

jtatum opened this issue Jul 29, 2016 · 1 comment

Comments

@jtatum
Copy link

jtatum commented Jul 29, 2016

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'.

@jtatum jtatum changed the title Possible to distinguish between Iterable[str] and str? Possible to distinguish between Sequence[str]/Iterable[str] and str? Jul 29, 2016
@gvanrossum
Copy link
Member

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants