@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 2677 / 12833)
Inner Functions
An inner function can be useful when performing some complex task more than once within another function,
J'ai essayé.
http://ideone.com/H9k6Dp
import numpy as np
def check_zundoko():
ints = np.random.randint(2, size=10)
def zunOrDoko(aval):
if aval == 0:
print('zun,'),
else:
print('doko,'),
print(ints)
for elem in ints:
zunOrDoko(elem)
check_zundoko()
résultat
Success time: 0.03 memory: 83072 signal:0
[1 1 1 1 0 0 1 1 0 0]
doko, doko, doko, doko, zun, zun, doko, doko, zun, zun,
Recommended Posts