A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Return type of alternative constructors

[Python-Dev] Return type of alternative constructors [Python-Dev] Return type of alternative constructorsGreg Ewing greg.ewing at canterbury.ac.nz
Sun May 8 20:55:09 EDT 2016
Guido van Rossum wrote:
> We could also consider this a general weakness of the "alternative 
> constructors are class methods" pattern. If instead these alternative 
> constructors were folded into the main constructor (e.g. via special 
> keyword args) it would be altogether clearer what a subclass should do.

A useful guideline might be that class methods can be provided
as sugar for alternative constructors, but they should all
funnel through the main constructor.

There's a convention like this in the Objective-C world where
one of an object's "init" methods is supposed to be documented
as the "designated initialiser", so that there is just one
thing that subclasses need to override.

-- 
Greg


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