Passing information between modules

Dan Kolis dankolis at gmail.com
Sat Nov 19 21:17:54 EST 2022


In a module mostly for this purpose; ( big program means many modules aka files ):
----------------------------------------------------------------------------------
globalIdeas.py
----------------------------------------------------------------------------------
# Empty object maker ( M T ) ... get it say it !
class MT():
    pass

# IO dot area readier 
def prepIO():

    # Prep for general IO use really
    dotObjOps.ioSupport = MT()
    dotObjOps.ioSupport.sequenceMacro = MT()


-----------------------------------------------------------------
In Every use module:
-----------------------------------------------------------------
import globalIdeas as       gi 

so now without burdensome advanced planning, a swap area is not only segregated by function
but doesn't overly pollute too much globalism everywhere.

New Idea:
gl.ioSupport.sequencesMacro.newStartupIdea = {}
gl.ioSupport.sequencesMacro.thingToReuse = 14
etc ...

A method in globalIdeas is named like startEverything():
  prepIO()
  prepNext()
  prepSounds()
   etc...

This seems to me amenable to management of large programs in which absolutely any shaped objects be created as needed and be RW sharable in orderly fashion, etc.

Its important if you read write files to plan ahead and have MT() names in surplus before you need them.

I cant see any drawback to this at all. Many program have very legit reasons to have universal ideas. This avoids the emotional burden of the' "global KW" ; entirely.

Regards,
Daniel B. Kolis











More information about the Python-list mailing list