Skip to content

Python Functions Nested

Quincy Larson edited this page Aug 20, 2016 · 1 revision

Python Nested functions

>>> def outside_fn():
...     def inside_fn():
...         print('inside')
...     print('outside')
...     inside_fn()
...
>>> outside_fn()
outside
inside
>>> inside_fn()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'inside_fn' is not defined

Previous

Clone this wiki locally