[Tutor] __init__
monikajg at netzero.net
monikajg at netzero.net
Mon Aug 29 18:52:31 EDT 2016
I cannot really try it. If I have a class without __init__ and the class does not inherit from a class that has init there is really no place for me to put print statement. IN Java if you do not have a constructor specified java calls a default constructor behind the scenes setting up memory. Does python call default __init__ if one is not defined? In two python classes that I took both teachers gave a different answers.
---------- Original Message ----------
From: Alan Gauld via Tutor <tutor at python.org>
To: tutor at python.org
Subject: Re: [Tutor] __init__
Date: Mon, 29 Aug 2016 23:10:30 +0100
On 29/08/16 20:03, monikajg at netzero.net wrote:
> If __init__ is not defined in a class, will it be called when creating an instance?
> What in a case if this class inherits from parent with __init__ and without __init__?
The easiest way to find out is try it and see what happens!
Just put appropriate print statements in the method.
Alan G
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
____________________________________________________________
oldcatlady.com (Sponsored by Content.Ad)
40 Years Later: How Do 'The Brady Bunch' Look Now?
http://thirdpartyoffers.netzero.net/TGL3241/57c4bcd6864d53cd60b7ast01duc
More information about the Tutor
mailing list