[Chicago] create all classes
Lukasz Szybalski
szybalski at gmail.com
Mon Feb 18 19:26:24 CET 2008
On Feb 1, 2008 1:14 PM, Kumar McMillan <kumar.mcmillan at gmail.com> wrote:
> On Feb 1, 2008 12:35 PM, Lukasz Szybalski <szybalski at gmail.com> wrote:
> > What is the difference between:
> >
> > class A:
> > def __init__(self):
> > ....
> > type <type 'classobj'>
> >
> > class B(object):
> > def __init__(self):
> > ....
> > type: <type 'type'>
> >
> >
One more question:
class A:
... def __init__(self):
... self.myvariable=''
... def fill(self,data):
... print self.myvariable
class B(A):
def __init__(self):
pass
x=B()
x.fill()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 5, in fill
AttributeError: B instance has no attribute 'myvariable'
Is there a reason I cannot access the init variable from class A in
class B? Is the init of class A never run? Why overloading doesn't run
init from A then init from B?
Should I be designing it differently? I need class A to have
myvariables so then I can overload it in as many classes as I need to.
Ideas?
Lucas
More information about the Chicago
mailing list