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
return_generator={True,False}
-> return_as={'list','generator'}
#1458
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1458 +/- ##
==========================================
- Coverage 94.88% 94.87% -0.02%
==========================================
Files 45 45
Lines 7471 7474 +3
==========================================
+ Hits 7089 7091 +2
- Misses 382 383 +1
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a few nitpicks. Happy to have the opinion of @GaelVaroquaux on this one.
Came here via the sprint/Franck at the sprint. How about |
As @adrinjalali mentioned it could be worth at least considering adding an extra method for different output type. Something like (but the name can certainly be better), joblib.Parallel(...).call_as_generator(delayed(sqrt)(i**2) for i in range(10))) It also feels that something that returns a variable type depending on the input parameter is not great API wise, and would confuse type checkers. I mean between list and iterators of results it could still work. But if you want to add an iterator of future results later that's a completely different return type. |
with At least it's very explicit. It's a bit verbose but I think I prefer this side of the tradeoff. |
If we ever go into returning "future" or "promise" objects I think we should introduce a completely new API (and probably mimic that of |
Some more online discussion later, we converge on (About futures/promises, returning such objects is definitely not in the scope of what Parallel offers, the misunderstanding comes from bad wording from me early on, sorry about that.) |
After discussion at the scikit-learn sprint, I also prefer the following:
This is explicit enough, technically correct and concise enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one nitpick
return_generator={True,False}
-> return_as={'list','submitted'}
return_generator={True,False}
-> return_as={'list','generator'}
Merging as the failure on |
Change the boolean
return_generator
keyword, toreturn_as
that is expected to take values in{'list','submitted'}
, to anticipate a future'completed'
keyword when implementing #1449 .