IMO bool is a special case because it's meant to be a final class, and the implementation of int (which is in C and so can violate most rules) doesn't respect that. But in general I think the only reasonable approach is that a construction class method should return an instance of the subclass; these class methods have a signature that's constrained by their signature in the base class. OTOH operators like __add__ cannot be expected to return an instance of the subclass, because these typically construct an instance using __new__/__init__, whose signatures are *not* constrained by the base class. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160508/52474383/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4