October 29th, 2006, 10:12 PM
OK, I need help sorting out this mess I made. Long story short I wanted to make some python program that is an OO representation of C syntax. So I have a father class "statement", which has two children classes "expression" and "loop".
I also have a child class of "expression" to be "block_statement", but I want the block_statement class to take in a number of arguments (that is to say "*args") and have them represented as a statement. Here's the problem: what if it's a loop and not an expression? I don't have enough experience with python yet to know if it would work properly.
There isn't by any chance a way to have an array of statements and have them be packed (so the loops and the expressions are where they need to be, so polymorphism can just sort it out) before I go ahead with the block statement creation?
def __init__(self, state=None):
def __init__(self, *args):
self.lines = 
for arg in args:
#would it know whether the arg is passed as a loop or expression?
"The Texan turned out to be good-natured, generous and likeable. In three days no one could stand him." Catch 22
by Joseph Heller.
Buddies? I have no buddies...
Give the BSD daemon some love (proud FreeBSD user)