[SciPy-User] scipy.optimize named argument inconsistency

Denis Laxalde denis.laxalde@mcgill...
Tue Sep 6 13:30:14 CDT 2011


On Tue, 6 Sep 2011 19:08:22 +0200,
Ralf Gommers wrote:
> > One possibility, that has been used in numpy.histogram, is to add a
> > "new=False" or "new=True" keyword, to switch behavior during
> > transition.
> 
> This may apply to a few cases where the outputs should be reshuffled or
> changed, but we should try to minimize "new=" - it requires the user to
> change his code twice because eventually the new keyword should also
> disappear again. The histogram change didn't go very smoothly imho. If the
> changes are large, another option is to just deprecate the whole function
> and write a new one with the desired interface. That would just require a
> single change for the user. It does depend on whether a good new name can be
> found of course.
> 
> For renaming of input parameters (both positional and keyword), just do the
> rename and then add the old name as a new keyword at the end. Then document
> in the docstring that it's deprecated, and check for it at the beginning of
> the function and if used do:
> warnings.warn("<informative message>", DeprecationWarning)
> The message should also state the scipy version when it was deprecated (0.11
> probably) and when it will disappear (0.12).

Ok. Sounds good.

> Could you make an overview of which functions should be changed, and your
> proposed new unified interface? The best solution could depend on the
> details of the changed needed.

The first thing to do is to improve names consistency, imo. I will
review all functions of the package and then post a list of possible
improvements. Then, I need to think a bit more about the new « unified
interfaces » idea as it could indeed solve some issues. As
suggested, I'll create a page on <http://projects.scipy.org/scipy> when
things will be more clear.

-- 
Denis




More information about the SciPy-User mailing list