[Tutor] does python have something like "#include" in C?

wesley chun wescpy at gmail.com
Mon Jun 29 22:02:19 CEST 2009


>> from showmodule import show
>>
>> then everything else will work.
>
> I don't think so. The exec in show() must be run in the namespace in
> which the symbols being displayed are defined.


yep, you're right. i didn't see the exec. it will only work if the
called function somehow had access to the same object references.

the OP would have to put the assignments into showmodule.py in
addition to show(), leaving only the calls to show() in foo.py. that
*should* work.

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Python Web Development with Django", Addison Wesley, (c) 2009
http://withdjango.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list