Hello all, Python newbie here:
I'm writing a market simulation in Python using Pysage, and want to generate an arbitrary number of agents (either buyers or sellers) using the mgr.register_actor()
function, as follows:
for name, maxValuation, endowment, id in xrange(5):
mgr.register_actor(Buyer(name="buyer001", maxValuation=100, endowment=500),"buyer001")
update name, maxValuation, endowment, id
What is a succinct, pythonic way to run that function call so that, each time the loop is run, the values of name, maxValuation, endowment, and id are changed, e.g. to name="buyer002", name="buyer003"...; maxValuation=95, maxValuation=90...; endowment=450, endowment=400...; "buyer002", "buyer003"...
and so on.
I have tried different for-loops and list comprehensions, but haven't found a way yet to dynamically update the function arguments without running into type issues.
Thanks in advance!