Skip to content

Fix integrate.fixed_quad docstring to indicate None return value #5083

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

Merged
merged 1 commit into from
Jul 26, 2015

Conversation

synapticarbors
Copy link
Contributor

I noticed that scipy.integrate.fixed_quad return a tuple with the second element always equal to None, that is not documented (I had to look at the source code to realize why I was getting a tuple back instead of just a float). This has been in the code for a long time and it looks like previous versions of the docstring properly accounted for this, but the current version does not.

I assume there is some legacy reason for always returning a None, and a quick search of Github shows that most people use it as something like:

val = scipy.integrate.fixed_quad(...)[0]

I'm not sure my proposed docstring is optimally worded, but I'm happy to adjust it if others have suggestions.

@ev-br
Copy link
Member

ev-br commented Jul 26, 2015

Not sure what the best wording is, but yeah, "a bit strange" is better than plain misleading. And this stray None is a bit strange. Merged, thank you @synapticarbors.

ev-br added a commit that referenced this pull request Jul 26, 2015
DOC: Fix integrate.fixed_quad docstring to indicate None return value
@ev-br ev-br merged commit 1fdb990 into scipy:master Jul 26, 2015
@ev-br ev-br added scipy.integrate Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org labels Jul 26, 2015
@ev-br ev-br added this to the 0.17.0 milestone Jul 26, 2015
@synapticarbors
Copy link
Contributor Author

Thanks @ev-br for merging my PR (this is my first contribution to scipy). I just assumed that since the None has been there for so long (since scipy 0.2 at least) that there must have been some interface that once existed with two useful return values and it's the way it is to not break code that assumed a tuple was returned.

@ev-br
Copy link
Member

ev-br commented Jul 27, 2015

As a guess, the second return value might be there to parallel quad which returns the tuple (value, error estimate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.integrate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants