[Python-ideas] proto-PEP: Fixing Non-constant Default Arguments
jcarlson at uci.edu
Sat Feb 3 04:08:44 CET 2007
Chris Rebert <cvrebert at gmail.com> wrote:
> Collin Winter wrote:
> > Tomer wasn't proposing that any of those decorators be included in the
> > standard library. Those cases where one of decorators isn't sufficient
> > as written? Modify it, use it in your code, post it to the cookbook.
> > Not every n-line function should be turned into syntax.
> Right, but for something used so frequently, should you really have to
> look through N decorator recipes, figure out which one you want, and
> then modify it, as opposed to a change in semantics that obviates the
> need for such decorators altogether?
Ahh, but the decorator recipes are more or less examples of how one
could go about removing the 1 additional if statement/conditional
expression. Obviously you don't *need* to look through the decorators,
because the 1 line if statement or conditional expression solves them
all! Really, you could think of the decorator variants as anti-patterns,
because they seek to complicate what is trivial to solve, which isn't an
issue in real world code.
More information about the Python-ideas