<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Apr 21, 2016 at 7:30 AM Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Apr 21, 2016 at 04:36:54PM +1000, Nick Coghlan wrote:<br>
<br>
> Builtins can be extended, you just have to override all the methods where<br>
> you want to change the return type:<br>
<br>
I wonder whether we should have a class decorator which automatically<br>
adds the appropriate methods?<br></blockquote><div><br></div><div>If I'm not mistaken, some of the dunders need to be overridden as part of the class definition and can't be added dynamically without some exec a la namedtuple. If so, are you still interested in creating that decorator?</div></div></div>