<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">yes for this case you will have to use @memoize() as all the arguments are optional ...<br><br>Thanks,<br>J<br><br><br>--- On <b>Tue, 28/6/11, Ian Kelly <i><ian.g.kelly@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Ian Kelly <ian.g.kelly@gmail.com><br>Subject: Re: Using decorators with argument in Python<br>To: "Jigar Tanna" <poisonousrattle5@gmail.com><br>Cc: python-list@python.org<br>Date: Tuesday, 28 June, 2011, 10:50 PM<br><br><div class="plainMail">On Tue, Jun 28, 2011 at 10:52 AM, Jigar Tanna<br><<a ymailto="mailto:poisonousrattle5@gmail.com" href="/mc/compose?to=poisonousrattle5@gmail.com">poisonousrattle5@gmail.com</a>> wrote:<br>> coming across to certain views from people, it is not a good practice<br>> to use<br>> decorators
 with arguments (i.e. @memoize() ) and instead it is good to<br>> just<br>> use @memoize. Can any of you guys explain me advantages and<br>> disadvantages of<br>> using each of them<br><br>The main concern I think is not with how the decorators are used but<br>how they are designed.  An argument-less decorator will normally be<br>used as @memoize, and @memoize() will likely not work.  A decorator<br>with arguments that are all optional will normally be used as<br>@memoize(), and @memoize will likely not work.  This naturally leads<br>to some confusion: do I need parentheses to use this particular<br>decorator or not?<br><br>As a personal design goal I try to make my decorators either take at<br>least one required argument or take no arguments at all.  This way<br>it's either @memoize or @memoize(foo), but never just the confusing<br>@memoize().<br><br>Cheers,<br>Ian<br>-- <br><a
 href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br></div></blockquote></td></tr></table>