[perl-python] 20050120 find functions in modules

Discussion in 'Python' started by Xah Lee, Jan 20, 2005.

  1. Xah Lee

    Xah Lee Guest

    © # -*- coding: utf-8 -*-
    © # Python
    ©
    © # once a module is loaded
    © # import mymodule
    © # one can find all the names it
    © # export with dir()
    ©
    © import sys
    © print dir(sys)
    ©
    © # without argument it gives the names
    © # you've defined
    © print dir()
    ©
    © # to find a list of built-in names
    © # import the module __builtin__
    © # and use dir on it.
    © import __builtin__
    © print dir(__builtin__)
    ©
    © # see
    © # http://python.org/doc/2.3.4/tut/node8.html
    ©
    © ----------------
    © # in Perl, Perl experts can achieve
    © # similar functionality by, for example:
    ©
    © use Data::Dumper ('Dumper');
    © print Dumper \%Data::Dumper::;
    ©
    © # it has to do with understanding the inner
    © # mechanisms of Perl's module system.
    ©
    © ---------------
    ©
    © Note: this post is from the Perl-Python
    © a-day mailing list at
    © http://groups.yahoo.com/group/perl-python/
    © to subscribe, send an email to
    © perl-python-subscribe @ yahoogroups.com if
    © you are reading it on a web page,
    © program examples may not run because
    © html conversion often breaks the code.
    ©
    © Xah
    ©
    © http://xahlee.org/PageTwo_dir/more.html
    Xah Lee, Jan 20, 2005
    #1
    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. Xiangliang Meng
    Replies:
    1
    Views:
    1,581
    Victor Bazarov
    Jun 21, 2004
  2. Wybo Dekker
    Replies:
    1
    Views:
    341
    Yukihiro Matsumoto
    Nov 15, 2005
  3. Xah Lee
    Replies:
    0
    Views:
    88
    Xah Lee
    Jan 20, 2005
  4. Replies:
    10
    Views:
    182
    A. Sinan Unur
    Apr 12, 2006
  5. Replies:
    0
    Views:
    80
Loading...

Share This Page