__init__ is the initialiser

Ethan Furman ethan at stoneleaf.us
Sat Feb 1 01:13:52 CET 2014


On 01/31/2014 03:43 PM, Ned Batchelder wrote:
> On 1/31/14 6:05 PM, Ben Finney wrote:
>> Ned Batchelder writes:
>
> I'm not hoping to change any official terminology. I just think that calling __init__ anything other than a constructor
> is confusing pedantry.  It is a constructor, and Python constructors work differently than those in C++ and Java.

And I would say the opposite.  __init__ is not creating anything, which is what I think of when speaking of a 
constructor.  I'd be willing to yield the point that Python has a pair of methods that make up the constructor (an 
allocator and an initializer), but I found calling __init__ the constructor very confusing.

--
~Ethan~



More information about the Python-list mailing list