Velocity Reviews

Velocity Reviews (
-   Perl Misc (
-   -   [perl-python] 20050120 find functions in modules (

Xah Lee 01-20-2005 07:50 AM

[perl-python] 20050120 find functions in modules
# -*- 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

# 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
to subscribe, send an email to
perl-python-subscribe @ if
you are reading it on a web page,
program examples may not run because
html conversion often breaks the code.


All times are GMT. The time now is 05:36 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.