If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Python confusion

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?