[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rewrote convertrules.py with a decorator
From: |
Han-Wen Nienhuys |
Subject: |
Re: rewrote convertrules.py with a decorator |
Date: |
Fri, 20 Jun 2008 15:10:15 +0200 |
This is an excellent idea. However, did you test this? AFAIK, the
decorator needs to accept the function as input argument.
On Fri, Jun 20, 2008 at 2:59 PM, Wilbert Berendsen <address@hidden> wrote:
> Hi,
>
> just for fun I rewrote convertrules.py (of current git) so that it uses a
> simple decorator function. Instead of the double procedure (function, and
> then calling conversions.append()) :
>
> def conv(str)
> # manipulate str
> return str
>
> conversions.append((version, conv, message))
>
> you can now simply write:
>
> @rule (version, message)
> def conv(str)
> # manipulate str
> return str
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen