-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
iterator traits for Base.product depend on number of arguments #16436
Comments
I changed this on a branch: https://github.com/JuliaLang/julia/commits/jb/compr2 Would probably be good to make a PR just for the last commit on that branch with this change to the Product iterator. |
Ok, will open a PR. Is it worth duplicating |
Hard to say. I would maybe wait to see if it somehow becomes a real problem. |
What is exactly the difference between For instance, consider the following four tests: @test Base.iteratorsize(Base.product(take(1:2, 2))) == Base.HasLength()
@test Base.iteratorsize(Base.product(take(1:2, 1), take(1:2, 1))) == Base.HasShape()
@test Base.iteratorsize(Base.product(1:2)) == Base.HasShape()
@test Base.iteratorsize(Base.product(1:2, 1:2)) == Base.HasShape() should they all pass with the new functionality? Or should the first one fail? |
My guess is a product of one iterator should be as similar as possible to that iterator. |
👍🏻 As a side note: Does
Does your argument for |
I think
|
Is there any particular reason to have
product
return different values depending on the number of iterators provided?Demo
This currently happens because
Base.product(itr)
calls theZip1
constructor which has a different behaviour.At the cost of some code duplication the alternative would be to implement a
Prod1
type and add the required behaviour instead of calling theZip1
constructor.(this is on master)
The text was updated successfully, but these errors were encountered: