[Python-Dev] PEP 8: Discourage named lambdas?
Antoine Pitrou
solipsis at pitrou.net
Sun May 4 12:55:38 CEST 2008
Steven D'Aprano <steve <at> pearwood.info> writes:
>
> I think you're exaggerating a tad here. Why would you be "very confused"
> when you see TITLEPATTERN() or foo(callback=TITLEPATTERN)? What else
> would TITLEPATTERN be but a callable when it's being used as a
> callable?
The real problem is this example is not the fact that there is a lambda,
but that the variable name doesn't reflect it is a callable. It is common
practice to use verbs for callables, and nouns for non-callables.
Thus I'd expect the variable to be called something like make_title_pattern
rather than TITLEPATTERN (and what's with the ugly allcaps by the way?).
Antoine.
More information about the Python-Dev
mailing list