Created
November 9, 2011 20:42
-
-
Save stefanv/1352940 to your computer and use it in GitHub Desktop.
Illustration of possible extra documentation for generic SciPy optimization interface.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def minimize_doc(method=None): | |
"""Additional arguments for SciPy minimisers. | |
* BFGS | |
- Arg 1 descr | |
- Arg 2 descr | |
* Newton | |
- Newton arg 1 | |
- Newton arg 2 | |
""" | |
if method is None: | |
print minimize_doc.__doc__ | |
else: | |
sections = minimize_doc.__doc__.split('*')[1:] | |
sections = [s.strip() for s in sections] | |
sections = [s for s in sections if s.startswith(method)] | |
print '\n'.join(sections) | |
if __name__ == "__main__": | |
print 'Print everything:' | |
minimize_doc() | |
print "Let's ask for Newton only:" | |
minimize_doc('Newton') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment