(beginners) howto ascribe _all_ fields of parent class to child class?

dmitrey openopt at ukr.net
Wed Mar 14 12:28:52 EDT 2007


Hi all,
I'm rewriting some code from other language  to Python; can anyone
explain me which way is the simpliest:
I have
class C1():
    def __init__(self):
         self.a = 5

class C2(C1):
    def __init__(self):
         self.b = 8

c = C2()
print c.b#prints 8
print c.a#prints error, because field a is absent

so how can I wrote the code that I'll got all class C1 fields (not
only funcs)

Thank you in advance,
Dmitrey




More information about the Python-list mailing list