On 30/03/17 21:08, Alan Gauld via Tutor wrote:
> Of course, the __init__ methods are special in any way
Should have said *not special* in any way...
> But remember that not calling super potentially leaves
> some attributes of your superclass uninitialized. By not
> calling super you assume full
On 03/30/2017 05:39 AM, Rafael Knuth wrote:
I am trying to wrap my head around the super constructor.
>
> Is it possible to embed a super constructor into an if / elif
> statement within the child class?
>
> if message == "string A": return X
> elif: return Y
>
> How should I modify my code
On 30/03/17 12:39, Rafael Knuth wrote:
I am trying to wrap my head around the super constructor.
>
> Is it possible to embed a super constructor into an if / elif
> statement within the child class?
Of course, the __init__ methods are special in any way
the normal coding mechanisms all work.
>> > I am trying to wrap my head around the super constructor.
Is it possible to embed a super constructor into an if / elif
statement within the child class?
if message == "string A": return X
elif: return Y
How should I modify my code below?
(I couldn't solve that by myself)
class A:
def
On 03/29/2017 08:33 AM, Rafael Knuth wrote:
> class A:
> def __init__(self, message):
> self.message = message
> print(message)
>
> I then modified the child class B like this:
>
> class B(A):
> def __init__(self, message):
> print("This is the message from your p
On 03/29/2017 04:02 PM, Mats Wichmann wrote:
> On 03/29/2017 08:33 AM, Rafael Knuth wrote:
>
>> class A:
>> def __init__(self, message):
>> self.message = message
>> print(message)
>>
>> I then modified the child class B like this:
>>
>> class B(A):
>> def __init__(self,
On Wed, Mar 29, 2017 at 10:32:52PM +0100, Alan Gauld via Tutor wrote:
> On 29/03/17 15:33, Rafael Knuth wrote:
> > I am trying to wrap my head around the super constructor.
>
> This is one of these cases where it matters whether you
> are using Python v2 or v3. Use of super in v3 is much
> easier
On Wed, Mar 29, 2017 at 04:33:20PM +0200, Rafael Knuth wrote:
> I am trying to wrap my head around the super constructor. Simple example:
>
> class A:
> def __init__(self):
> print("world")
>
> class B(A):
> def __init__(self):
> print("hello")
> super(B, self).__i
On 29/03/17 15:33, Rafael Knuth wrote:
> I am trying to wrap my head around the super constructor.
This is one of these cases where it matters whether you
are using Python v2 or v3. Use of super in v3 is much
easier. It looks from your examples like you are using
v2 but it would be good to confir