Same as what would happen when you use the call operator on an object that has an AttributeError raising property:

>>> class D:
...  @property
...  def __add__(self):
...   raise AttributeError('Not so fast, pardner!')
...
>>> D() + D()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 4, in __add__
AttributeError: Not so fast, pardner!


Thanks,
-- Ionel
Cristian Mărieș, http://blog.ionelmc.ro

On Sat, Apr 18, 2015 at 12:44 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
On 04/18, Ionel Cristian Mărieș wrote:

> __add__ as a property/descriptor seems to work fine, eg:
>
> >>> class C:
> > ...  @property
> > ...  def __add__(self):
> > ...   return lambda other: [self, other]
> > ...
> > >>> C() + C()
> > [<__main__.C object at 0x0000000003652AC8>, <__main__.C object at
> > 0x0000000003652CC0>]
> >
>
> Am I missing something?

What happens when your __add__ raises an AttributeError?

--
~Ethan~
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/