How Do I think of import?

Discussion in 'Python' started by Andy@home.com.au, Apr 5, 2009.

  1. Guest

    Hi:

    Sorry for the detail of this question but I hope its useful to others as
    well as myself.
    I'm planning to do a Python wrapper for an existing GUI environment that
    is not one of the standard environments. So I have complete freedom. Ive
    done various smaller things in Python with some success. But this is
    large enough to need proper planning.

    The current environment is C but with a C++ structure. Widgets are
    developed from simpler widgets, PtBasic -> PtLabel-> PtButton etc. Each
    widget has its own C header that defines widget parameters, callback
    options various functions. Each header includes the header defining the
    next level down. I plan to extract parameters, bit masks callbacks etc
    using a modified h2py, so I have all I need at my fingertips. But how do
    I organise it? What structure do I impose on my import files?

    The options seem to be:
    a) copy the C headers structure!
    "from photon.PtButton import *" photon.PtButton imports Its own
    definitions and imports photon.PtLabel which imports PtBasic etc.
    This is a simple structure. However- all users will import
    multiple widgets and I see a lot of wasted effort by Python trying to
    import PtBasic and other modules multiple times.

    b) Create modules by their function!
    photon.defititions, photon.callbacks and photon.functions
    then maybe a breakdown under definitions for example.
    photon.definitions.PtButton

    c) Just give up trying to be efficient and assume that the user will
    want to access all definitons etc. Simply create a photon.all and let
    that be imported. 'from photon.all import *"

    No matter what path I consider, I see a very crowded namespace. Is this
    inevitable? Should I just get on with the wrapper and not worry ?

    Sizing.. Currently PtBasic has 90 definitions PtLabel 54 and PtButton
    11.

    Thanks,
    Andy
    , Apr 5, 2009
    #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. Paul Opal
    Replies:
    12
    Views:
    926
    Paul Opal
    Oct 11, 2004
  2. JPractitioner
    Replies:
    13
    Views:
    20,118
    Roedy Green
    Feb 24, 2006
  3. Replies:
    0
    Views:
    583
  4. Replies:
    1
    Views:
    853
    Jack Klein
    Apr 13, 2005
  5. David Mark
    Replies:
    17
    Views:
    216
    David Mark
    Mar 23, 2010
Loading...

Share This Page