Conditional based on whether or not a module is being used
Steve Holden
steve at holdenweb.com
Fri Mar 5 14:52:46 EST 2010
Pete Emerson wrote:
> In a module, how do I create a conditional that will do something
> based on whether or not another module has been loaded?
>
> Suppose I have the following:
>
> import foo
> import foobar
>
> print foo()
> print foobar()
>
By the way, the above statements are never going to work, because
modules aren't callable. Maybe you want
print foo.foo()
print foobar.foobar()
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/
More information about the Python-list
mailing list