* John Fouhy <[EMAIL PROTECTED]> [051130 19:21]:
<..snip...>
> On 01/12/05, Tim Johnson <[EMAIL PROTECTED]> wrote:
> superclass __init__ methods, or when you want to call them. So, it is
> up to you to make that call.
>
> You can do that like this:
>
> class sub(test):
> def __init__(self):
>
On 01/12/05, Tim Johnson <[EMAIL PROTECTED]> wrote:
> My thanks to Christopher and Liam. I've revisited this
> with the following:
> class test:
> def __init__(self):
> self.s = ' there'
> def val(self,V):
> print '%s%s' % (V,self.s)
> class sub(test):
> def __init__(sel
My thanks to Christopher and Liam. I've revisited this
with the following:
class test:
def __init__(self):
self.s = ' there'
def val(self,V):
print '%s%s' % (V,self.s)
class sub(test):
def __init__(self):
pass
The following console session:
>>> T = mylib.test()
>
ember 2005 3:46 p.m.
To: tutor@python.org
Subject: [Tutor] Class Inheritance -> NameError
The following code snippet is meant to test inheritance:
class test:
def __init__(self,v):
self.__val = v
def val(self):
print self.__val
class sub(test):
def __init__(self):
Tim Johnson schrieb:
> The following code snippet is meant to test inheritance:
> class test:
> def __init__(self,v):
> self.__val = v
> def val(self):
> print self.__val
> class sub(test):
> def __init__(self):
> val()
> The following console session has an erro
The following code snippet is meant to test inheritance:
class test:
def __init__(self,v):
self.__val = v
def val(self):
print self.__val
class sub(test):
def __init__(self):
val()
The following console session has an error:
>>> T = mylib.test('hello')
>>> s = my