A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-May/144472.html below:

[Python-Dev] Return type of alternative constructors

[Python-Dev] Return type of alternative constructors [Python-Dev] Return type of alternative constructorsGuido van Rossum guido at python.org
Sun May 8 03:03:45 EDT 2016
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>
More information about the Python-Dev mailing list

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