Skip to content

Conversation

@ikappaki
Copy link
Contributor

Hi,

could you please consider patch to remove explicit support of single-use iterables in sequences. It fixes #1192.

single-use iterables now throw a TypeError, when they are implicitly or explicitly coerced into a sequence. A new iterator-seq is introduced to explicitly convert them into a seq instead . See #1198 (comment) for the rationale.

The count fn was also updated to behave the same.

There were a few places where single use iterators were converted implicitly to a seq, which are now explicitly converted using a iterator-seq or the python equivalent instead.

Tests are added for the same, as well as documentation section under Python Iterators.

Thanks

Copy link
Member

@chrisrink10 chrisrink10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the very thoughtful conversation and analysis in #1198 and for the PR @ikappaki

This looks very nice. I have a couple of very minor comments, but I think this looks good overall and I'm glad to get this merged in.

@chrisrink10 chrisrink10 merged commit 0d5a5b1 into basilisp-lang:main Apr 19, 2025
12 checks passed
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

Successfully merging this pull request may close these issues.

Unexpected behavior when passing a Python generator to a map

2 participants