Circular package references

Bernhard Herzog herzog at online.de
Tue Aug 8 10:08:49 EDT 2000


Serge Beaumont <serge at sergebeaumont.com> writes:

> Hello all,
> 
> I've looked everywhere: the docs, FAQs, dejanews and c.l.py. But I can't
> find an answer to my questions:
> 
> - Are circular package references allowed in Python? I think not, from
> the exceptions I get... or there's something I'm not doing right.

Circular package references are allowed.

> - When two classes reference each other, MUST they be in the same
> package?

No.

In both cases, getting it to work may be a little tricky. In particular,
imports of the form 'from module import xyzzy' should be avoided
in these cases; use 'import module' instead.

> - I don't understand the global keyword either. Could this be a help
> here?

No. The global keyword is used to allow assignment to module level
variables in a function. By default all variables assigned to in a
function are local variables.

-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/



More information about the Python-list mailing list