alex23 <wuwe...@gmail.com> wrote:

> Makoto Kuwata <k...@kuwata-lab.com> wrote:
>> I'm sad about this restriction because:
>>
>>     @recipe.product('*.html').ingreds('$(1).rst')
>>     def file_html(c):
>>         # do something
>>
>> is enough simple and more readable than:
>>
>>     @recipe.product('*.html')
>>     @recipe.ingreds('$(1).rst')
>>     def file_html(c):
>>         # do something
>>
>> But I'll follow the Python's philosophy.
> 
> Personally, I'd find this approach a lot clearer:
> 
> rst2html = recipe.product('*.html').ingred('$(1).rst')
> 
> @rst2html
> def file_html(c):
>    # etc
> 
> It allows for easier reuse of your decorators and it labels it in a
> way that I can understand from the name as opposed to having to
> decipher the decorator method chain to work out its intent.

Or another way would be to define `recipe` such that something like this 
works:

@recipe(product='*.html', ingreds='$(1).rst')
def file_html(c):
   ...




-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to