[Python-Dev] The Return Of Argument Clinic

R. David Murray rdmurray at bitdance.com
Tue Aug 6 11:44:15 CEST 2013


On Mon, 05 Aug 2013 16:53:39 -0700, Larry Hastings <larry at hastings.org> wrote:
> Let me put it this way: Which is more surprising to the person 
> unfamiliar with the code?  That this __init__ doesn't get all the 
> parameters, and the base class __init__ is getting called 
> automatically?  Or that this funny function "custom_init" is what gets 
> called, and this class is not allowed to have a function called __init__?

Definitely the former is more surprising.  Especially since, as Nick
points out, the last part of your statement isn't true: there can
be a function called __init__, it just has to replicate the superclass
logic if it exists, which is the way Python normally works.

I use this "call a hook method from __init__" pattern in the email
package's new header parsing code, by the way, for whatever that is
worth :)

--David


More information about the Python-Dev mailing list