__init__ is the initialiser

Cameron Simpson cs at zip.com.au
Fri Jan 31 18:18:29 EST 2014


On 01Feb2014 10:05, Ben Finney <ben+python at benfinney.id.au> wrote:
> Ned Batchelder <ned at nedbatchelder.com> writes:
> > Why can't we call __init__ the constructor and __new__ the allocator?
> 
> Because those terms already have meanings, and “__new__” fits the
> meaning of “constructor” better.

+1 on not giving new conflicting meanings to terms already well
defined in practice.

Better just to make in clear in the __init__ docs that there is a
separate construction step.
-- 
Cameron Simpson <cs at zip.com.au>

On two occasions I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?'  I am not able rightly to apprehend the
kind of confusion of ideas that could provoke such a question.
        - Babbage



More information about the Python-list mailing list