469,935 Members | 1,612 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

Correct Attribute Assignment Methodology?

Say I have these classes:

class Parent(object):
"""Parent is abstract"""
a=None
def showA():
return self.a

class Child(Parent):
"""inherits a and showA from Parent"""

def __init__(self,a,b):
self.a=a
self.b=b

def showAB():
return self.a,self.b
class GrandChild(Child):
"""inherits all of the above"""

def __init__(self,a,b,c):
self.a=a
self.b=b
"""should this be Child.__init__(a,b)? or Child.__init__(b)?""
"""if so; why? if not why not?"""
self.c=c

Thanks for answering these very basic questions but I am not certain
about the correct way. I know that in Python, assignment in the
GrandChild class will work but is that correct?

--Tim



--
************************************************** ************************
Join the OSHIP project. It is the standards based, open source
healthcare application platform in Python.
Home page: https://launchpad.net/oship/
Wiki: http://www.openehr.org/wiki/display/...loper%27s+page
************************************************** ************************

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBIj1/t2TFRV0OoZwMRAqKYAKCOpxHJsbcucuRx76yumQA7f8m5WgCff iJk
ZoCE6TYC3yNSR5Gu3D1APEI=
=PBeb
-----END PGP SIGNATURE-----

Jul 30 '08 #1
0 634

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Frank Millman | last post: by
13 posts views Thread by globalrev | last post: by
reply views Thread by Terry Reedy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.