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

Change tee or add a new tee that provides the copy iterator into a new scope #50

Open
cjrh opened this issue Nov 28, 2024 · 1 comment

Comments

@cjrh
Copy link
Owner

cjrh commented Nov 28, 2024

Perhaps something like:

(
  Iter.open(filename)
  .tee(
      # This is the second iterator, provided to a callable
      lambda it: (
        it
        .map(str.lower)
        .write_to_file("lower.txt")
      )
  )
  # This continues with the original lines iterator
  .map(str.upper)
  .write_to_file("upper.txt")
)
@cjrh
Copy link
Owner Author

cjrh commented Nov 28, 2024

Need to understand carefully what runs when in examples like these. Should tee internally pass the second iterator into the callback, wait for that to return, and then yield? Not sure there's another way to do it.

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

1 participant