<br><br><div class="gmail_quote">On 7 June 2010 12:34, Michael Foord <span dir="ltr"><<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>[snip...]<div class="gmail_quote"><div>I think you misunderstood, he was suggesting making the property descriptor instances callable. <br><br>Not a bad idea, but as a change to a builtin it would be covered by the language moratorium. Easy to do in a subclass of property though. <br>

<br>At the moment you do the following, which is a bit ugly:<br><br>>>> class Foo(object):<br>...  @property<br>...  def foo(self):<br>...   return 'foo'<br>... <br>>>> f = Foo()<br>>>> Foo.foo.__get__(f)<br>

'foo'<br><br>The reason for wanting to do this are the same reasons as you would call an unbound method.<br><br></div></div></blockquote><div><br>Or this which is still slightly ugly but at least gets rid of the magic method call:<br>
<br>>>> class Foo(object):<br>...  @property<br>...  def foo(self):<br>...   return 'foo'<br>... <br>>>> f = Foo()<br>>>> Foo.foo.fget(f)<br>'foo'<br><br><br>Michael<br><br> </div>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote"><div>Michael<br> </div><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div><div></div><div><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></div><font color="#888888"><br><br clear="all"><br>-- <br><a href="http://www.voidspace.org.uk" target="_blank">http://www.voidspace.org.uk</a><br><br><br>
</font></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.voidspace.org.uk">http://www.voidspace.org.uk</a><br><br><br>