#26287: SimpleLazyObject doesn't implement __radd__
-----------------------------+------------------------------------
Reporter: kezabelle | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by debanshuk):
Replying to [ticket:26287 kezabelle]:
> As far as I can tell, the implementation can't just be
> {{{
> __radd__ = new_method_proxy(operator.radd)
> }}}
> because that doesn't exist, which is rubbish.
> {{{
> __radd__ = new_method_proxy(operator.attrgetter("__radd__"))
> }}}
> also won't work because types may not have that attr, and attrgetter
doesn't supress the exception (correctly)
Wouldn't the following code work?
{{{
__add__ = new_method_proxy(operator.add)
__radd__ = new_method_proxy(lambda a, b: operator.add(b, a))
}}}
I have tested this and it seems to work as excepted.
--
Ticket URL: <https://code.djangoproject.com/ticket/26287#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.421af37f91bdcb295abe07b9ec69cbf4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.