0
Is there any use case for a closure where the inner function doesn't have its own parameter?( Python)
Because I got no replies, I'll try to ask this using snippets: def f_outer(x): def f_inner(): return x * 2 # or whatever return f_inner # fin = f_inner(5) print(fin()) Is there any weird chance on Earth for this to be better than def f_outer(x): def f_inner(): return x * 2 return f_inner() # changed print(f_outer(5)), If f_inner() takes no argument? May I generalize that the only use for closure is having a "closure factory"? Thanks in advance :-)
4 Antworten
0
</CODER> It's in Russian :-) Didn't see language oprion in desktop mode but I'll look at the examples, thank you 😊
0
</CODER> Hehe no I try to stay away from unnervingly friendly, doublespeaking psychopathic cyclopses(google and derivatives and all other monopolies) on phone as much as I can but I'll definitely look it up when on pc, thanks for the tip.