[PEAK] Package organization

Ulrich Eck ueck at net-labs.de
Thu Dec 4 09:05:53 EST 2003


> Also, a discussion came up on IRC lately about 'from peak.api import *' and 
> what it returns.  Some folks argued (in effect) that it should only import 
> core APIs and primitives, not framework APIs.  I'm not sure I agree with 
> this, and would like to see more discussion on it here.

yeah .. it was me :)

> To me, the "namespace pollution" argument doesn't make a lot of sense, 
> because if I need local meaning for one of those names, I can still have 
> it.  But I always put 'from peak.api import *' at the very top of the 
> module, so anything after that is going to override it.  (Not that I can 
> think of any reason I'd have a module global with one of those names.)

as i use peak.core to develop additional frameworks (database, workflow, gui, 
net, ...) using the same structure as peak, I don't need all the framework modules 
all the time and if so, i prefer to signalize it through an import at the top. 

which "net" module is currently loaded - the one from peak or the one from nll ? 
i think it's easier to read the source if the projects/apps get larger if you
import explicitly - especially when new/other extensions/frameworks to/for peak appear.

1. many modules of the framework/apps only use core api
2. i now have a namespace clash between peak.net and nll.net, i'ld prefer to import
subcomponents directly, or do a "from peak.api import net as peak_net"

> However, what I *could* do, is add a 'core' module that exports only the 
> core APIs from 'api'.  Thus, if one wishes to use the whole API 
> (frameworks, core, and primitives), one would 'from peak.api import *', but 
> if one wishes to use only the core API, one could use 'from peak.core 
> import *'.

this is the best solution i think.

Ulrich




-- 
-------------------------------

Ulrich Eck
net-labs Systemhaus GmbH
CEO & Code-Artist
Ebersberger Str. 46
85570 Markt Schwaben - Germany

eMail: ueck <at> net-labs.de
phone: +49 8121 4747 10
fax:   +49 8121 4747 77




More information about the PEAK mailing list