News for hackers. Stuff that matters.
Re:"Real" anonymous functions for Python by mpeg on Sunday March 31, 2024 @02:00PM (#39886457)
I tend to use inner functions (nested def) when I need something more than a simple lambda, but don't want to come up with a good name or pollute the class / module namespace

It works okay, but I do wish there was a better way

Re:"Real" anonymous functions for Python by jmholla on Sunday March 31, 2024 @04:27PM (#39887767)
> It works okay, but I do wish there was a better way

What's wrong with it?

Re:"Real" anonymous functions for Python by mpeg on Sunday March 31, 2024 @05:39PM (#39888280)
nothing really, probably just me, but it always felt a bit ugly to nest function definitions, plus it can separate the (often single-use) function from the place it is being used in