How to tailor output of help()

Discussion in 'Python' started by Kyle, Dec 24, 2009.

  1. Kyle

    Kyle Guest

    Hi all,
    I'm a graduate student in the physical sciences and still new to
    Python. I'm writing a module of often-used code and have included
    several math functions in my module via

    from math import cos

    and similarly for other functions. When I input help(mymodule) into
    the console, cos() and its docstring are listed in the output section
    for my module's functions. However, I only want functions that I have
    written to appear, not those that I imported. I know this is merely
    aesthetic, but is there a way to eliminate functions that I imported
    from the function list in the output from help()? Thanks,

    -kmd
     
    Kyle, Dec 24, 2009
    #1
    1. Advertising

  2. Kyle

    Steve Holden Guest

    Kyle wrote:
    > Hi all,
    > I'm a graduate student in the physical sciences and still new to
    > Python. I'm writing a module of often-used code and have included
    > several math functions in my module via
    >
    > from math import cos
    >
    > and similarly for other functions. When I input help(mymodule) into
    > the console, cos() and its docstring are listed in the output section
    > for my module's functions. However, I only want functions that I have
    > written to appear, not those that I imported. I know this is merely
    > aesthetic, but is there a way to eliminate functions that I imported
    > from the function list in the output from help()? Thanks,
    >

    Try setting the __all__ variable in your module to a list of the names
    you want your module to export.

    regards
    Steve

    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
    Holden Web LLC http://www.holdenweb.com/
    UPCOMING EVENTS: http://holdenweb.eventbrite.com/
     
    Steve Holden, Dec 24, 2009
    #2
    1. Advertising

  3. Kyle

    Kyle Guest

    > Try setting the __all__ variable in your module to a list of the names
    > you want your module to export.


    Perfect. Thanks for the help.
     
    Kyle, Dec 27, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Bentley

    Output / Debug window output bug?

    John Bentley, Sep 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    611
    John Bentley
    Sep 10, 2003
  2. chuck amadi
    Replies:
    1
    Views:
    509
    Larry Bates
    Jun 23, 2004
  3. Paul
    Replies:
    1
    Views:
    446
  4. jmr
    Replies:
    2
    Views:
    349
  5. cirillo curiosone

    How to tailor the path of an external js file?

    cirillo curiosone, Jul 28, 2004, in forum: Javascript
    Replies:
    3
    Views:
    100
    Harag
    Jul 28, 2004
Loading...

Share This Page