Python Forum
what is the purpose of the global name space?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what is the purpose of the global name space?
#11
(Oct-17-2018, 02:24 AM)Skaperen Wrote: there are three files.
So you need to change the title of this thread, because there is no global namespace in your sense. There is a global namespace at file scope, but three files define three global namespaces. You can exchange data between the functions by sharing a common object in these namespaces, for example
# haad.py
common = type('Common', (), {})()
common.a = 1
common.b = 2
and
# ien.py
from __main__ import common

def ien():
    common.c = 3
    common.d = 4
Reply


Messages In This Thread
RE: what is the purpose of the global name space? - by Gribouillis - Oct-17-2018, 04:57 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020