<br><br><div class="gmail_quote">On 16 March 2011 19:18, Greg Ewing <span dir="ltr"><<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Larry Hastings wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
def assign(fn):<br>
return fn(fn.__name__)<br>
<br>
@assign<br>
def content_size(name):<br>
return overridable_property(name, "Size of the content area.") <br>
How bad do you want it? ;-)<br>
</blockquote>
<br></div>
Not quite badly enough to replace all my existing<br>
overridable_property declarations with something that<br>
ugly. :-) But I appreciate the suggestion, and I'll<br>
keep it in mind next time I'm designing anything<br>
similar.</blockquote><div><br></div><div>You should be able to replace it with something like:</div><div><br></div><div><meta charset="utf-8"> @do_something<br> def content_size():<br> return "Size of the content area."</div>
<div> </div><div>Where do_something calls the function to get the string argument and takes the name from the function.__name__ (and uses them to create and return the overridable_property).</div><div><br></div><div>Michael</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5"><br>
<br>
-- <br>
Greg<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><pre cols="72"><a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br><br>May you do good and not evil<br>May you find forgiveness for yourself and forgive others<br>
May you share freely, never taking more than you give.<br>-- the sqlite blessing <a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a></pre>
<br>