[Python-ideas] An ABC representing "Iterable, Sized, Container"
Guido van Rossum
guido at python.org
Mon Jul 25 13:58:04 EDT 2016
More information about the Python-ideas mailing list
Mon Jul 25 13:58:04 EDT 2016
- Previous message (by thread): [Python-ideas] An ABC representing "Iterable, Sized, Container"
- Next message (by thread): [Python-ideas] An ABC representing "Iterable, Sized, Container"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jul 25, 2016 at 10:19 AM, Gregory P. Smith <greg at krypto.org> wrote: > Given how often the str problem comes up in this context, I'm thinking a > common special case in type annotation checkers that explicitly exclude str > from consideration for iteration. It's behavior is rarely what the > programmer intended and more likely to be a bug. Should we have IterableButNotString, CollectionExceptString, NonStringSequence, or all three? I suppose the runtime check would be e.g. isinstance(x, Iterable) and not isinstance(x, (str, bytes, bytearray, memoryview))? And the type checker should special-case the snot out of it? -- --Guido van Rossum (python.org/~guido)
- Previous message (by thread): [Python-ideas] An ABC representing "Iterable, Sized, Container"
- Next message (by thread): [Python-ideas] An ABC representing "Iterable, Sized, Container"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list