Tag: ATI%s OBA output variable BSP exists index div color
Directly put the code, there are comments, will not parse the
1 # ############################2 #change the value of a variable, and the value of the variable that is related to it also changes equally3 #php-like reference assignment, macro view4 # ############################5 6Relation = []#relation is a list of the collections that are loaded in the relationship7 8 9 #bind a variable that has a relationshipTen defBind (*Arg): One ifLen (ARG) < 2: A " " - determine the number of bound variables - " " the Print("error: Bind at least two variables") - exit () - Globalrelation - forIinchARG: + " " - checks if the bound variable exists + " " A ifI not inchglobals (). Keys (): at Print("Error: Variable%s does not exist"%(i)) - exit () - - #for loading -Flag =Set (ARG) - ifLen (relation): ini =0 - whileI <Len (relation): to ifLen (relation[i) &flag): +Relation[i] = Relation[i] |Flag - Break thei + = 1 * ifi = =Len (relation): $ relation.append (flag)Panax Notoginseng Else: - relation.append (flag) the + #parameter, the value of the remaining variable is equal to the value of the first variable argument Aindex = 1 the whileIndex <Len (ARG): +Globals () [arg[index]] =globals () [arg[0]] -Index + = 1 $ $ - #assigning values to variables - defassign (Var, value): the Globalrelation - ifLen (relation):Wuyii =0 the whileI <Len (relation): - ifVarinchRelation[i]: Wu forIteminchRelation[i]: -Globals () [Item] =value About Break $i + = 1 - ifi = =Len (relation): - Print('Error: The assigned variable is not yet bound') - exit () A Else: + Print("Error: No related collection currently exists") the exit () - $ theA ='Sky' theb =' Land' theBind'a','b')#binding has a relational variable the Print(relation)#print a list of currently-related collections [{' A ', ' B '}] - Print(A, B)#values for output variables A and B sky Sky inAssign'a','Sea')#change the value of a variable the Print(A, B)#values for output variables A and B sea sea
How Python implements a PHP-like reference assignment