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.1...@gmail.com> wrote: From: Lie Ryan <lie.1...@gmail.com> Subject: Re: Using decorators with argument in Python To: python-list@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
-- http://mail.python.org/mailman/listinfo/python-list