On 22/06/2016 01:24, Rick Johnson wrote:
On Tuesday, June 21, 2016 at 6:16:09 PM UTC-5, BartC wrote:
I tried using your method but it didn't work:
...you'll find a thread i authored, that includes an object
exposing a global namespace named "G". Details of how to
inject the symbol G are included. After you have this module
installed,
Oh, after you have that installed. Naturally I skipped straight to your
code and got:
NameError: global name 'G' is not defined
G.BDFL = "GvR"
But even if it worked, I don't think this two-parter counts as a 'global
variable' as it is understood. I might as well just create my own G
module containing:
BDFL="GvR"
and import it in both A and B. Then I can also write G.BDFL in those
modules. But remember the point was avoid having to write Test.test_var.
(Perhaps your method dispenses with having to create such a module and
to have to explicitly import it into each module.)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list