You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
numpy deprecation: Should regular_grid return a tuple? #3235
My vote is for the option 3. The question here is do we need any kind of deprecation? Probably, the most popular use case of the regular_grid output is the direct indexing with the returned grid, however, some users might be using list-specific post-processing methods (e.g. .append). Perhaps, a 1-release deprecation is a way to go...
I agree with @soupault. Option 3 is the right way to go (it is simple and fast to cast the tuple as a list for users who want that), but it needs a deprecation path. My suggestion is:
return_type={None, tuple, list}.
Since we're now Python 3 only, I suggest making this a keyword-only argument. =D (It'll need fixing for a backport, but the fix should happen there.)
So, I do agree with the sentiment of having a deprecation cycle, but I think we should think longterm that we don't want to have kwargs that just stay there forever, for "legacy purposes".
So in addition to deprecating the list->tuple, I think we should have a plan to deprecate the added argument.
Just throwing it out there, but would simply making the change and documenting it in release notes be less disruptive to users than adding an unnecessary kwarg - so they can keep doing it wrong if they so choose - which then will disruptively break their workflow later?
Seems like a lot of trouble including two separate deprecations, a brand-new temporary kwarg with a shelf life, and branching output paths could be avoided if we just... did the right thing.
Put differently
Path direct change to Tuple: Potentially disruptive to a very small subset of users. Documented well and they handle it.
Option 3, with default Tuple: Immediate disruptive change to this same set of users. They are then provided the option of not changing, and some will take it - ignoring our warning that it has a sunset. Two versions later, another disruptive change for these folks (plus anyone else who decided to START using the wrong kwarg in the interim!).
Option 3, with default List instead of Tuple for next two versions: Everyone gets warnings all the time until they start using a kwarg which is going to go away, creating more problems.
There should be one, correct way. My vote is just change this to Tuple directly and document it.
After discussion with @JDWarner at SciPy 2018, I'm inclined to agree with a straight switch in behaviour. Specifically, despite our existing policy, when making this decision we should consider not only the policy, but also:
how many people are likely to be affected by this (few or none)
the cost of the deprecation (in this case, four versions of fiddling, and causing people to make two adjustments over four versions, instead of a single one.
Having said this, I suggest that we add a section Notes to the docstring that mentions the change, which version it occurred in, why, and how to fix it. That way if we have ended up breaking someone's code, they will instantly know how to fix it.
Activity
rectangular_grid returns a tuple for numpy 1.15.
rectangular_grid returns a tuple for numpy 1.15.
soupault commentedon Jul 1, 2018
My vote is for the option 3. The question here is do we need any kind of deprecation? Probably, the most popular use case of the
regular_gridoutput is the direct indexing with the returnedgrid, however, some users might be using list-specific post-processing methods (e.g..append). Perhaps, a 1-release deprecation is a way to go...rectangular_grid returns a tuple for numpy 1.15.
rectangular_grid returns a tuple for numpy 1.15.
jni commentedon Jul 5, 2018
I agree with @soupault. Option 3 is the right way to go (it is simple and fast to cast the tuple as a list for users who want that), but it needs a deprecation path. My suggestion is:
return_type={None, tuple, list}.Since we're now Python 3 only, I suggest making this a keyword-only argument. =D (It'll need fixing for a backport, but the fix should happen there.)
hmaarrfk commentedon Jul 5, 2018
So, I do agree with the sentiment of having a deprecation cycle, but I think we should think longterm that we don't want to have
kwargsthat just stay there forever, for "legacy purposes".So in addition to deprecating the list->tuple, I think we should have a plan to deprecate the added argument.
jni commentedon Jul 5, 2018
totally happy to do that. Just add it to TODO.txt. For version 0.19. 😂
JDWarner commentedon Jul 14, 2018
Just throwing it out there, but would simply making the change and documenting it in release notes be less disruptive to users than adding an unnecessary kwarg - so they can keep doing it wrong if they so choose - which then will disruptively break their workflow later?
Seems like a lot of trouble including two separate deprecations, a brand-new temporary kwarg with a shelf life, and branching output paths could be avoided if we just... did the right thing.
Put differently
There should be one, correct way. My vote is just change this to Tuple directly and document it.
jni commentedon Jul 17, 2018
After discussion with @JDWarner at SciPy 2018, I'm inclined to agree with a straight switch in behaviour. Specifically, despite our existing policy, when making this decision we should consider not only the policy, but also:
Having said this, I suggest that we add a section Notes to the docstring that mentions the change, which version it occurred in, why, and how to fix it. That way if we have ended up breaking someone's code, they will instantly know how to fix it.
rectangular_grid returns a tuple for numpy 1.15.
rectangular_grid returns a tuple for numpy 1.15.
rectangular_grid returns a tuple for numpy 1.15.