[Python-ideas] Fix that broken callable builtin
Ethan Furman
ethan at stoneleaf.us
Fri Apr 17 23:44:47 CEST 2015
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~
More information about the Python-ideas
mailing list