[Zope-CMF] dev question on CMFDefault.__init__.py

Mark McEahern marklists@mceahern.com
Mon, 21 Oct 2002 10:50:12 -0500


[Tres Seaver]
> >     cmfdefault_globals=globals()
> >
> >     Why is that assignment even there?
>
> So that other modules can import it, and use it to find where on the
> filesystem the CMFDefault product lives.

In a pure Python package, isn't __path__ sufficient?

> This initialization *must* be done during import, as there may be other
> products which depend on being able to find the generated base classes
> before 'initialize' is run.  Python's dependency management is based
> purely around the 'import' keyword;  anything which must be exported to
> other packages must be available at module scope, else you are
> vulnerable to "order of import" issues.

Where then does one discover what things must be exported to other packages?
I assume one answer is to read and study the source.  (I'm sure I'm not
doing the best job of that, but I'm trying.  <wink>)  It just seems like the
way CMFDefault.__init__.py is layed out, makes it hard to understand what is
accidental vs. what is intentional vs. what is a workaround for some
potential bug.

Thanks for your comments.

// mark

-