472,334 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

Python Package Construction

Hi All,

I would like feedback on the proper/best 'Pythonic' approach.

This is a rather subjective question. Where is the trade-off between
package name lengths and faithfulness to the specifications?

[Discussion follows]

I am implementing a set of specifications for healthcare IT for Python
programmers to be able to develop interoperable healthcare applications.
I am using ZCA (aka.Zope3) extensively.

My desire is to implement the specs as faithfully as possible for two
1) teachability - how easy/difficult is it to teach the framework and
specifications to new developers?
2) maintainability - which approach, if either, will make it easier to
maintain the framework if/when the specifications change?

My first pass was to develop a skeleton of the specs using Interfaces
from the ZCA approach and then the implementations following the
document structure of the specs.

The specs are available via SVN at:

It is best to probably use real examples. Following the document
structure for packaging AND using the ZCA convention of having a
sub-directory for interfaces caused massive circular import issues due
to some classes being used in the interface definition of classes inside
the same interface file being imported into the implementation file. If
that sounds confusing; it is. It was confusing to write too. :-) If
anyone has questions I'll try to expand.

It is best to probably use specific, real examples.

(note class names are converted from the upper case, underscore
separated style to CamelCase)

The package openehr.rm.datatypes.text defines the implementation class
CodePhrase. The associated interface file
openehr.rm.datatypes.interfaces.text needed CodePhrase as an attribute
type in DvCodedText and TermMapping needs both CodePhrase and
DvCodedText. This quickly got out of control.

So my solution to solving the circular imports is to take each interface
and implementation and put them into one file. Research tells me that
this is probably the second mostly popular ZCA approach. So,
ICodePhrase and CodePhrase are now in
openehr/rm/datatypes/codephrase.py, DvCodeText and IDvCodedText in
openehr/rm/datatypes/dvcodedtext.py, etc.

But wait, now I don't have a 'text package'. So if codephrase.py and
dvcodedtext.py were in openehr/rm/datatypes/text/ that would solve the
problem. BUT! Throughout the specs many of the names are VERY long
already. Adding another package name that is from 4 - 15 (or more)
characters long adds to the length of already long import statements,

(sorry for the email line wraps)

from openehr.am.archetype.creferenceobject import

should really be

from openehr.am.archetype.constraintmodel.creferenceobj ect import

Thoughts, opinions and jeers all gratefully accepted. :-)


Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
************************************************** ************
*You may get my Public GPG key from popular keyservers or *
*from this link http://timothywayne.cook.googlepages.com/home*
************************************************** ************

Version: GnuPG v1.4.7 (GNU/Linux)


Jun 27 '08 #1
0 794

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Irmen de Jong | last post by:
QOTW: "Giving full access rights to a secretary or new programmer ought to insure an occasional random file deletion." -- Raymond Hettinger "I...
by: Irmen de Jong | last post by:
QOTW: "Confronting the Martellibot is like flirting with an encyclopedia, I'd rather not do it myself, but I respect those who do, because it...
by: Irmen de Jong | last post by:
QOTW: "The best use for a bug report on comp.lang.python is as an object lesson for your grandchildren: 40 years from now you can search the...
by: Raymond Hettinger | last post by:
QOTW: "Of course it's still an ugly idiom. But there's a distinction between ugly-but-works and ugly-and-wrong." -- Michael Chermside commenting...
by: Raymond Hettinger | last post by:
QOTW: "Python seems to encourage and reward incremental effort, and it leads one to explore extensions and improvements to programs because the...
by: Simon Brunning | last post by:
QOTW: "The security 'droids have decided that since the MS Office Suite is a 'standard' application then software written in MS Office VBA must be...
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 393 open (+15) / 3315 closed (+17) / 3708 total (+32) Bugs : 908 open (+22) / 5975...
by: Michael Spencer | last post by:
Announcing: compiler2 --------------------- For all you bytecode enthusiasts: 'compiler2' is an alternative to the standard library 'compiler'...
by: Roger Ineichen | last post by:
Hi Tim For a usecase like this, I personaly recommend to defina all interfaces in one module which probably is a namespace if you need alot of...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.