__init__ is the initialiser

Ben Finney ben+python at benfinney.id.au
Sat Feb 1 00:59:37 CET 2014

Ned Batchelder <ned at nedbatchelder.com> writes:

> On 1/31/14 6:05 PM, Ben Finney wrote:
> > Here we disagree. I think the meaning “… and that returns the new
> > instance” is entailed in the meaning of “constructor”.
> > […]
> You say these terms already have meanings, and that constructor means
> a function that returns the new instance. Then your word "constructor"
> isn't the same as C++'s word "constructor"? Those don't return the
> instance. Neither do Java constructors. In terms of the code
> developers actually write in __init__, it looks an awful lot like a
> C++ or Java constructor, and serves precisely the same purpose.

These are good points, thanks for raising them.

 \     Lucifer: “Just sign the Contract, sir, and the Piano is yours.” |
  `\     Ray: “Sheesh! This is long! Mind if I sign it now and read it |
_o__)                                later?” —http://www.achewood.com/ |
Ben Finney

More information about the Python-list mailing list