Defining Multiple Objects at Once

SilverShadow GPodubs at hotmail.com
Wed May 26 14:14:45 EDT 2004


Hello,

I'm having trouble with something that may be easily remedied.  I use
Cantera running on Python.  I need to make multiple "Reactor()" objects
and have them assigned a different (user defined) name.  For example:

reactors = [R1, R2, R3...etc.]
for reac in reactors:
     reac = Reactor()

My problem is there is no way to operate on each reactor separately. 
(e.g.  R1.temperature())  The only thing that can be done is
reac.temperature(), but that gets overwritten each time.  So, my question
is, is there any way to assign multiple names w/o having to write out
lines of explicit definitions in the code?  Thank you in advance.




More information about the Python-list mailing list