News for hackers. Stuff that matters.
Re:Code blocks in Python by Peaker on Friday April 20, 2012 @05:44PM (#3869930)
This problem is indeed less severe when the names are defined in a non-local namespace (inside a class, or as globals).

But callback-style often appeals to defining very-local callback code. In fact, it would be anonymous in languages that support it, but it is forced to not only be given a name, but also potentially clutter some namespace (or be written in reverse order).

Consider having every for/while loop, or every "if" require giving a name to the code block[s] within it. It sounds insane. The same doesn't sound insane for library functions, but in my opinion that's really just because everybody's used to this limitation.

When I moved from Python to Haskell, one of the many joys was that I could stick an anonymous code block anywhere so easily.

Re:Code blocks in Python by hythloday on Friday April 20, 2012 @07:48PM (#3870291)
Thanks for the explanation, that makes sense.