Status: New
Owner: asmeurer
Labels: Type-Defect Priority-Medium EasyToFix Documentation

New issue 1575 by asmeurer: help(module) contains a bunch of irrelevant  
stuff
http://code.google.com/p/sympy/issues/detail?id=1575

Doing >>> help(module) often returns stuff that is not relevant to the  
user.  For example, help(solvers)
returns the following, in addition to the actual useful docstrings:
FUNCTIONS
     all(...)
         all(iterable) -> bool

         Return True if bool(x) is True for all values x in the iterable.

     any(...)
         any(iterable) -> bool

         Return True if bool(x) is True for any x in the iterable.

     ...

     warn(...)
         Issue a warning, or maybe ignore it or raise an exception.

...
...
DATA
     GS_POLY = 0
     GS_POLY_CV_1 = 2
     GS_POLY_CV_2 = 3
     GS_RATIONAL = 1
     GS_RATIONAL_CV_1 = 4
     GS_TRANSCENDENTAL = 5
     S = S
     a = a_
     b = b_
     c = c_
     d = d_
     e = e_
     f = f_
     g = g_
     h = h_
     patterns = None
     t = 'h'
     x = _x


It looks like Python automatically ignores anything that starts with an  
underscore, but any global variables are
included in DATA, and it looks like imported all() and any() functions  
appear there too.  It includes more than
just what is in __init__.py, which is nice, because the user can see  
docstrings for helper functions that may not
be imported into the global namespace, or are imported using a wrapper.

The solution is easy:  just add a del statement at the end of the file  
deleting anything that should not be in
help() that doesn't start with an underscore.

For example, you could add the following to solvers.py:

del all, any, warn, GS_POLY, GS_POLY_CV_1, GS_POLY_CV_2, GS_RATIONAL,  
GS_RATIONAL_CV_1,
GS_TRANSCENDENTAL, S, a, b, c, d, e, f, g, h, patterns, t, x

Doing this is a good idea anyway.  Consider for example issue 1454, where  
all Basic objects had an attribute
".k" because k was used as a global variable in basic.py.

I do not know if this would break anything because of some kind of global  
variable hack.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to