-
Notifications
You must be signed in to change notification settings - Fork 11
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
Shouldn't Multi.zip()
throw exceptions for collections of different sizes?
#1
Comments
Hi @danon, Thanks for your kind words and interest in IterTools PHP. For zipping iterables that are different sizes, I think you can make a good argument for both throwing exceptions and iterating as much as you can. The behavior that the library has for FYI: Here is how Python works zipping iterables of different sizes: >>> for x, y in zip([1, 2, 3], ['a', 'b']):
... print(x, y)
...
1 a
2 b
>>> for x, y in zip([1, 2], ['a', 'b', 'c']):
... print(x, y)
...
1 a
2 b The library also provides a Thanks again for your interest in IterTools PHP! |
You could design API in sucha a way:
But of course, that's your library and your decision, so I'm not gonna push it, just asking. To me, throwing exception is more natural, I rarely ever zip collections of different sizes, so I would prefer the exception. I'm leaving the decision to you. |
Method Single::filterUnique() added.
I supposed zipping of collections like in python is supposed to work for collections that are of the same size. If they are different, I think it would be a good idea to throw an exception in that case.
BTW, cool library, nice
ReadMe.md
and good tests!The text was updated successfully, but these errors were encountered: