On Tue, Aug 10, 2010 at 8:22 PM, Steve Holden <st...@holdenweb.com> wrote: > One of the things that's slightly irking about the decorator syntax is > that a decorator is always called with exactly one argument, and that if > you want to write a parameterized decorator you therefore end up writing > a function that returns a function that returns a function. > > I've scratched my head about how partials (or indeed anything else) > could be used to make the extra level of indirection necessary, but > haven' come up with anything that even I could regard as acceptable. But > I can't escape this feeling that there must be a way.
Someone at EuroPython brought up this very criticism. But my argument against it is: you should be able to write either @bar(args) def func(): ... or foo = bar(args) @foo def func(): ... and you should be able to predict how these two relate using standard knowledge about what it means to say foo = bar(args) and then use foo in an expression. That pretty much rules out solutions using partial IMO. (Not that I mind -- I find examples using partial as hard to read as code using reduce()... :-) -- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com