472,337 Members | 1,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,337 software developers and data experts.

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 665

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Frank Millman | last post by:
Hi all I want to control the assignment of a value to an attribute. Instead of allowing it to be changed directly, I want to enforce that a...
5
by: Russell Warren | last post by:
I just ran across a case which seems like an odd exception to either what I understand as the "normal" variable lookup scheme in an instance/object...
13
by: globalrev | last post by:
wassup here? 7 Traceback (most recent call last): File "C:\Python25\myPrograms\netflix\netflix.py", line 22, in <module> print...
0
by: Terry Reedy | last post by:
Tim Cook wrote: Child.__init__(self,a,b) # requires all three params. In this simple case, I would probably do what you did. But a reason to...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.