########################## #global_and_isTypeStr.txt ########################## #by D@CC #on 2022CMar03 # probably was not completely tested def access_global_list_definition(): # This must be defined in the pir2A.py # But it can be called from anywhere using # pir2A.access_global_list() global gAL gAL="" gAL=gAL+"."+"g_targTempL0" ; global g_targTempL0 gAL=gAL+"."+"g_gALtest" ; global g_gALtest nCount=2 returnValue = "globalAList was defined containing a global Count of : ",nCount #print("gAL:"+gAL) return returnValue #def end def access_global(gName,AorR,value): # This must be defined in the pir2A.py # It doesn't need to be called from outside the pir2A.py # check if in the gAL (globalAccessList) global gAL #def end def get_global(gName): global gAL #print("in get_global,gAL:"+gAL) #this is usually called from outside the pir2A.py # it can be called e.g. gALtest = pir2A.get_global("g_gALtest") return access_global(gName,"Retrieve","na") #def end def set_global(gName,value): #print("in set_global, gName:"+gName) #this is usually called from outside the pir2A.py # it can be called e.g. pir2A.set_global("g_gALtest",value) # WARNING: it will over-ride the current value of this global value access_global(gName,"Assign",value) if isTypeStr(value): returnValue= gName+" was set="+value else: returnValue= gName+" was set="+str(value) #doesn't work if value is not a string return returnValue #def end def get_targTempL0(str1): returnValue = access_global("g_targTempL0","Retrieve","na") return returnValue #def end def isTypeStr(vName): Ttype=type(vName) if Ttype=="": return True else: return False #def end #/global_and_isTypeStr.py