Creating methods depending on packages that have been installed

Discussion in 'Python' started by C Gillespie, May 24, 2005.

  1. C Gillespie

    C Gillespie Guest

    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
     
    C Gillespie, May 24, 2005
    #1
    1. Advertisements

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. okaminer
    Replies:
    3
    Views:
    423
    okaminer
    Aug 1, 2005
  2. Learner
    Replies:
    4
    Views:
    2,417
    Learner
    Jan 27, 2006
  3. Replies:
    3
    Views:
    712
    Jason
    Apr 28, 2008
  4. Alexey Vlasov
    Replies:
    2
    Views:
    2,065
    Alexey Vlasov
    Dec 2, 2008
  5. Tuomas Vesterinen
    Replies:
    2
    Views:
    1,251
    Tuomas Vesterinen
    May 16, 2010
  6. Marc Heiler
    Replies:
    1
    Views:
    250
    Stefan Lang
    Jan 26, 2008
  7. Kenneth McDonald
    Replies:
    5
    Views:
    662
    Kenneth McDonald
    Sep 26, 2008
  8. Peng Yu
    Replies:
    0
    Views:
    177
    Peng Yu
    Nov 21, 2010
Loading...