What is a class?

castironpi at gmail.com castironpi at gmail.com
Sat Mar 8 18:52:41 CET 2008

On Mar 7, 6:16 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Thu, 06 Mar 2008 08:40:47 -0800, castironpi wrote:
> > you
> > could say exec( open( 'modA.py' ).read() ) ==> import modA
> Yes, you could say that, but you'd be wrong. Please test your code before
> making such claims in the future.

Aye aye.  -1 response not phrased in the form of a question.

Is it correct that exec( open( 'modA.py' ).read() ) -and- from modA
import * create "effectively" same results, such as in the remaning
program not checking __module__ attributes?

Is there a slight modification of both sides that does cover a non-
trivial volume of programs, such as maybe,
exec( open( 'modA.py' ).read(), locals= dict( __module__= 'modA' ) ) -
and- from modA import *, or something?  I notice that

from toimp import *

exec( open( 'toimp.py' ).read() )

generate the same output so far.

More information about the Python-list mailing list