[Python-ideas] Statement local functions and classes (aka PEP 3150 is dead, say 'Hi!' to PEP 403)

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Oct 14 09:15:43 CEST 2011


Nick Coghlan wrote:

> The heart of the problem is that the name 'key_func' is repeated
> twice, encouraging short, cryptic throwaway names.

Seems to me you're encouraging that even more by requiring
a name that doesn't even get used -- leading to suggestions
such as using '_' as the name.

> Maybe I'm worrying too much about that, though

Yes, I think you are. If an exception occurs in the callback
function, the traceback is still going to show you the
source line where it occurred, so there won't be any
trouble tracking it down.

Also there are already plenty of situations where the name
of the function by itself doesn't tell you very much. It's
common to have many methods with the same name defined in
different classes.

-- 
Greg



More information about the Python-ideas mailing list