On Thu, Jun 2, 2016 at 11:36 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Thu, 2 Jun 2016 06:22 pm, Lawrence D’Oliveiro wrote: > >> On Wednesday, June 1, 2016 at 8:02:14 AM UTC+12, Ben Finney wrote: >>> (Note that ‘__init__’ is not a constructor, because it operates on the >>> *already constructed* instance, and does not return anything. >> >> Believe it or not, that *is* what “constructor” means in every OO >> language. > > I don't believe it. > > C# is an OO language, and it distinguishes constructors and initialisers: > > https://msdn.microsoft.com/en-us/library/bb397680.aspx > > (although they don't seem to mean quite the same as what they mean in > Python).
Indeed. The "constructor" in that example is the equivalent of the Python __init__ method. The "initializer" is not a part of the class at all but just a syntactic sugar for creating an instance and setting some of its properties at the same time in a single statement. It's very similar to the C array initializer syntax, e.g.: int myArray[] = {1, 2, 3, 4, 5}; -- https://mail.python.org/mailman/listinfo/python-list