<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Same as what would happen when you use the call operator on an object that has an AttributeError raising property:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">>>> class D:<br>... @property<br>... def __add__(self):<br>... raise AttributeError('Not so fast, pardner!')<br>...<br>>>> D() + D()<br>Traceback (most recent call last):<br> File "<stdin>", line 1, in <module><br> File "<stdin>", line 4, in __add__<br>AttributeError: Not so fast, pardner!</blockquote></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><span style="font-family:trebuchet ms,sans-serif"><span style="color:rgb(51,51,51)"><br><font size="2"><span style="color:rgb(51,51,51)">Thanks,</span><br><span style="color:rgb(153,153,153)">-- Ionel</span></font></span><font size="2"><font style="color:rgb(153,153,153)"> Cristian Mărieș, <a href="http://blog.ionelmc.ro" target="_blank">http://blog.ionelmc.ro</a><br></font></font></span></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Sat, Apr 18, 2015 at 12:44 AM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/18, Ionel Cristian Mărieș wrote:<br>
<br>
</span><span class="">> __add__ as a property/descriptor seems to work fine, eg:<br>
><br>
> >>> class C:<br>
> > ... @property<br>
> > ... def __add__(self):<br>
> > ... return lambda other: [self, other]<br>
> > ...<br>
> > >>> C() + C()<br>
> > [<__main__.C object at 0x0000000003652AC8>, <__main__.C object at<br>
> > 0x0000000003652CC0>]<br>
> ><br>
><br>
> Am I missing something?<br>
<br>
</span>What happens when your __add__ raises an AttributeError?<br>
<br>
--<br>
~Ethan~<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a></div></div></blockquote></div><br></div>