Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def hello(x,y):
- good=hi(iy,ix)
- "then do somethings,and use the parameter'good'."
- return something
- def hi(iy,ix):
- "code"
- return good
- def hello(x,y):
- fordf150 = hi(y,x)
- "then do somethings,and use the variable 'fordf150'."
- return something
- def hi( ix, iy ):
- "compute some value, good."
- return good
- varA = 5 #A normal declaration of an integer in the main "global" namespace
- def funcA():
- print varA #This works, because the variable was defined in the global namespace
- #and functions have read access to this.
- def changeA():
- varA = 2 #This however, defines a variable in the function's own namespace
- #Because of this, it's not accessible by other functions.
- #It has also replaced the global variable, though only inside this function
- def newVar():
- global varB #By using the global keyword, you assign this variable to the global namespace
- varB = 5
- def funcB():
- print varB #Making it accessible to other functions
- def hello(x,y):
- good=hi(iy,ix)
- "then do somethings,and use the parameter'good'."
- return something
- def hi(iy,ix):
- "code"
- return great
Add Comment
Please, Sign In to add comment