Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How Do I think of import?

Reply
Thread Tools

How Do I think of import?

 
 
Andy@home.com.au
Guest
Posts: n/a
 
      04-05-2009
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




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
I think I will get this and I think I will get that =?iso-8859-1?Q?mark=5Fdigital=A9?= Digital Photography 19 03-18-2006 01:42 AM
Need help: Is Quick-Union-Find the right solution to this problem (Now I don't think so and I think that topological sorting should be the way to go...?) ? aredo3604gif@yahoo.com C Programming 0 04-12-2005 05:06 PM
Think your Wireless Network is Secure? Think Again. Careers Computer Security 7 01-31-2004 07:04 AM
Think Off Brand Inks Are Just as Good in your Inkjet Printer - Think Again! John Horner Digital Photography 5 11-09-2003 09:38 PM



Advertisments