[Tutor] advice on global variables
Prasad, Ramit
ramit.prasad at jpmorgan.com
Tue Jul 10 22:26:59 CEST 2012
> >
> > file: a.py
> >
> > import b
> > global_var = "global"
> >
> To answer your most basic question:
[file b.py]
> import a
> a.global_var
This would be a cyclical import and is bad even if it does not fail.
Remove the common dependencies (in this case the global variables)
and place it in a third module (c.py) that both a.py and b.py can
import.
> But again, that's probably not the right way to solve your problem.
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
--
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Tutor
mailing list