Creating methods depending on packages that have been installed

C Gillespie csgcsg39 at hotmail.com
Tue May 24 12:41:22 EDT 2005


Dear All,

What is the best way of creating methods depending on the packages that have
been installed.

A silly example is

try:
    import somepack
    class hello:
        def __init__(self):
            print 'hi'
        def some(self):
            print 'some'
except:
    class hello:
        def __init__(self):
            print 'hi'

This is obviously not what I want - since it looks ugly and I wish to test
for lots packages.

Any ideas?

Thanks

Colin






More information about the Python-list mailing list