In [ ]:
a = 0
for i in range(10):
a += i * 2
b = i + ( i * 3)
print(b)
In [ ]:
global_a = 1
global_b = 2
def add():
local_a = -1
local_b = -2
global_a += 2
global_b += 3
local_a -= 2
local_b -= 3
print('globl_a == ', global_a)
print('globl_b == ', global_b)
print('local_a == ', local_a)
print('local_b == ', local_b)
add()
In [ ]:
global_a = 1
global_b = 2
print('globl_a id == ', id(global_a))
print('globl_b id == ', id(global_b))
def add():
local_a = -1
local_b = -2
global_a = 3
global_b = 4
print('local_a id == ', id(local_a))
print('local_b id == ', id(local_b))
print('globl_a id == ', id(global_a))
print('globl_b id == ', id(global_b))
global_a += 2
global_b += 3
local_a -= 2
local_b -= 3
print('globl_a == ', global_a)
print('globl_b == ', global_b)
print('local_a == ', local_a)
print('local_b == ', local_b)
add()
In [ ]:
global_a = 1
global_b = 2
print('globl_a id == ', id(global_a))
print('globl_b id == ', id(global_b))
def add():
local_a = -1
local_b = -2
global global_a
global global_b
print('local_a id == ', id(local_a))
print('local_b id == ', id(local_b))
print('globl_a id == ', id(global_a))
print('globl_b id == ', id(global_b))
global_a += 2
global_b += 3
local_a -= 2
local_b -= 3
print('globl_a == ', global_a)
print('globl_b == ', global_b)
print('local_a == ', local_a)
print('local_b == ', local_b)
add()
In [ ]:
def add():
a = 1
b = 2
def boo(a, b): return a * (b + 1)
return boo(a, b)
add()
In [ ]:
boo(3, 4)
In [ ]:
add.boo(3, 4)
In [ ]:
boo = lambda a, b: a * (b + 1)
boo(3, 4)
In [ ]:
bo = lambda a: True
bo()
In [ ]:
#cmds.button(c=lambad a: boo(5, 7))
In [ ]:
# --------------------------------------------------------------------------------
# Copyright (c) 2013 - 2014 Mack Stone. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# --------------------------------------------------------------------------------