[SciPy-user] object-oriented help
Benjamin J. Racine
Fri Nov 21 20:37:08 CST 2008
Please let me know if I should be posting just general OO stuff somewhere else, but I figure that this might be relevant to a lot of procedural programming types just jumping into python (and the example is straight out of FEA). Anyways, I have the following code below. The problem is, I need to be able to instantiate many nodes for a given element as well as many elements for a model. Tackling this with built-ins such as arrays, lists and dicts seems straightforward, but I can't wrap my head around it in OO for some reason. Do I just need to make my element and node inherit from a list and then use the ".append()" when I instantiate it?
Any help greatly appreciated. Thanks, Ben Racine
Created by Ben Racine on 2008-11-21.
Copyright (c) 2008 __MyCompanyName__. All rights reserved.
"""docstring for model"""
"""docstring for element"""
elementID = 'something'
elementPressure = 'something else'
nodeCount = 'something else altogether'
"""docstring for node"""
nodeID = '1'
x = 'xx'
y = 'yy'
z = 'zz'
if __name__ == "__main__":
test = model()
More information about the SciPy-user