[Zope-Coders] module-scope conditionals

Chris McDonough chrism at zopemafia.com
Thu Oct 23 13:36:47 EDT 2003


I think Shane means we have a better configuration system now, and we
don't need to rely on envvars as the subject in module-scope conditional
tests.

This isn't the only place we rely on module-scope dynamicism, though. 
For example, any module that puts something into another namespace other
than its own at import time is suspect, e.g. ZODB's __init__.py
inserting Persistence into sys.modules.  This isn't a conditional, but
it's the same general idea.  This is the kind of thing I think most
people try to avoid until they need to do it for backwards compatibility
reasons.  I'm suggesting that if we see any checkins that do this, we
should question the need to do it.

On Thu, 2003-10-23 at 12:40, Paul Winkler wrote:
> On Wed, Oct 22, 2003 at 09:03:36PM -0400, Shane Hathaway wrote:
> > On Wed, 22 Oct 2003, Chris McDonough wrote:
> > 
> > > This example is just one of quite a few that are in Zope right now.  I'm
> > > going to try to stamp them out as I see them, but I'd suggest that we
> > > encourage a coding style that frowns on dynamicism that happens at
> > > import time in the future...
> > 
> > That's fine.  I think conditional code is a really good thing until there 
> > is something better to replace it.  Now that we have something better, go 
> > for it.
> 
> what's the something better?
> sorry for being dense.




More information about the Zope-Coders mailing list