Re: import order or cross import

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 07:56, Duncan Booth wrote: However, you really should try to separate scripts from modules otherwise the double use as both __main__ and a named module is going to come back and bite you. I second this. Something with a __main__ can use (import) other modules, but shoud

Re: import order or cross import

2007-01-03 Thread Roland Hedberg
Jussi Salmela wrote: > Roland Hedberg kirjoitti: >> I'm having a bit of a problem with import. >> >> I'm writing a marshalling system that based on a specification will >> create one or more files containing mostly class definitions. > Maybe I'm missing something, but why is the class BaseColor i

Re: import order or cross import

2007-01-03 Thread Roland Hedberg
Duncan Booth wrote: > > Remember that all statements in Python are executed at the time they are > encountered: there are no declarations (apart from 'global') so no looking > ahead to see what classes or functions are coming up. Yes, I've seen this time and time again. > One other complicati

Re: import order or cross import

2007-01-03 Thread Duncan Booth
Roland Hedberg <[EMAIL PROTECTED]> wrote: > Now, running ONE.py causes no problem it will print "Black", but running > TWO.py I get: > AttributeError: 'module' object has no attribute 'BaseColor' > > So, how can this be solved if it can be ? > When you execute an import statement, it checks whe

Re: import order or cross import

2007-01-03 Thread Jussi Salmela
Roland Hedberg kirjoitti: > Hi! > > I'm having a bit of a problem with import. > > I'm writing a marshalling system that based on a specification will > create one or more files containing mostly class definitions. > > If there are more than one file created (and there are reasons for > creating

import order or cross import

2007-01-03 Thread Roland Hedberg
Hi! I'm having a bit of a problem with import. I'm writing a marshalling system that based on a specification will create one or more files containing mostly class definitions. If there are more than one file created (and there are reasons for creating more than one file in some instances) then