GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Behavior of generator expressions doesn't match the docs when passed a non-iterable · Issue #143493 · python/cpython Closed Closed Copy link Labels 3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:>>> def f(s): ... return (x for x in s) ... >>> f(1) <generator object f.<locals>.<genexpr> at 0xe8529f655c70> According to the docs (and in earlier versions) the correct behavior is: The current behavior on main is arguably more logical as it is consistent with generators, but Hyrum's law dictates we need to be backwards compatible. https://docs.python.org/3/reference/expressions.html#generator-expressions This issue has a bit of history. On main, we use "virtual iterators" and have kept the We can keep both the nice performance and conform to the docs, by keeping the we have: CPython versions tested on:CPython main branch Operating systems tested on:No response Linked PRsActivity
MetadataMetadataAssigneesLabels3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |