Post

Real Python
Real Python@realpython·
🐍⚙ Python Tricks — Nested functions Python allows functions to be defined inside other functions. These are called nested functions or inner functions. In this example, every time you call "speak", it defines a new inner function "whisper" and then calls it immediately after.
Real Python tweet media
English
0
0
0
0
Gael Varoquaux 🦋
Gael Varoquaux 🦋@GaelVaroquaux·
@realpython In general, one should avoid such nesting. One reason is that the return argument cannot be persisted easily (pickled), which makes parallel computing harder.
English
0
0
0
0
JP Raymond
JP Raymond@J_P_Raymond·
@realpython The example really doesn’t help understanding how nested functions could be helpful 😐
English
0
0
0
0
Paylaş