Using decorators with argument in Python
jigar tanna
jigar_15in at yahoo.co.in
Wed Jun 29 06:54:42 EDT 2011
okie ....i agree with your comment, if the case is simple we would
prefer not to make it complex but if required there would be nor harm in
using decorators with Arguments
Thanks,
J
--- On Tue, 28/6/11, Lie Ryan <lie.1296 at gmail.com> wrote:
From: Lie Ryan <lie.1296 at gmail.com>
Subject: Re: Using decorators with argument in Python
To: python-list at python.org
Date: Tuesday, 28 June, 2011, 10:36 PM
On 06/29/2011 02:52 AM, Jigar Tanna wrote:
> coming across to certain views from people, it is not a good practice
> to use
> decorators with arguments (i.e. @memoize() ) and instead it is good to
> just
> use @memoize. Can any of you guys explain me advantages and
> disadvantages of
> using each of them
Simplicity is one, using @decor() means you have at least three-level
nested functions, which means the code is likely to be very huge and
perhaps unnecessarily.
However, there is nothing wrong with using decorators with arguments;
except that if you have a simpler alternative, then why use the more
complex ones?
--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110629/df9ecd5e/attachment-0001.html>
More information about the Python-list
mailing list