<div class="gmail_quote">On Thu, Mar 18, 2010 at 2:49 AM, nbv4 <span dir="ltr"><<a href="mailto:nbvfour@gmail.com" target="_blank">nbvfour@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>@printable=True<br>
def some_func(*args, **kwargs):<br>
return "sup"<br>
<br>
Any thoughts?</div></blockquote></div><br><div>If you have that many properties, there's no need to extend the syntax, just do something like:</div><div><br></div><div><div>def prop(**props):</div><div> def wee(f):</div>
<div> f.__dict__.update(props)</div><div> return f</div><div> return wee</div>
<div> </div><div>@prop(printable=True, other_prop="yo!")</div><div>def some_func():</div><div> return "sup, %s" % some_func.other_prop</div><div><br></div><div>print some_func() # prints "sup, yo!"</div>
</div>