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/2005-January/050683.html below:

[Python-Dev] Let's get rid of unbound methods

[Python-Dev] Let's get rid of unbound methods [Python-Dev] Let's get rid of unbound methodsGlyph Lefkowitz glyph at divmod.com
Wed Jan 5 16:37:16 CET 2005
On Tue, 2005-01-04 at 22:12 -0500, Bob Ippolito wrote:
> If you have a class hierarchy where this is a problem, it's probably 
> pretty fragile to begin with, and you should think about making it 
> simpler.

I agree with James's rant almost entirely, but I like super() anyway.  I
think it is an indication not of a new weakness of super(), but of a
long-standing weakness of __init__.

One approach I have taken in order to avoid copiously over-documenting
every super() using class is to decouple different phases of
initialization by making __init__ as simple as possible (setting a few
attributes, resisting the temptation to calculate things), and then
providing class methods like '.fromString' or '.forUnserialize' that
create instances that have been completely constructed for a particular
purpose.  That way the signatures are much more likely to line up across
inheritance hierarchies.  Perhaps this should be a suggested "best
practice" when using super() as well?


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