Message195034
| Author |
belopolsky |
| Recipients |
belopolsky, eric.snow, jackdied, jess.austin, mark.dickinson, ncoghlan, ysj.ray |
| Date |
2013年08月12日.22:51:54 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1376347914.41.0.606908135425.issue5516@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Eric,
Could you share details of your use-case? My experience with subclassing from basic python types including date/time has been mostly negative. The problem is that when I subclass, I want to inherit the rich set of operations such as +, -, *, etc., and add a few methods of my own. After that, I want to always use instances of my subclass instead of the stdlib one. This does not work because adding instances of my subclass returns an instance of the superclass unless I override __add__ explicitly. (See #2267.) This kills all benefits of subclassing as compared to containment.
These days I try to stay away from subclassing date/time, int/float, or anything like that and thus have little incentive to resolve this issue. And it does not look like we have a workable solution. |
|