yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #02899
Re: O.engines.append ?
> O.engines=O.engines+[YourEngine()]
> I have tried this way and you insert the engine at the end of the list
> (or vector). What if you want to insert the engine at a specific
> position? If .append does not work I suppose that also .insert does
> not as well..
For instance, to insert after 3rd element, you would write
O.engines=O.engines[:3]+[YourEngine()]+O.engines[3:]
(see http://docs.python.org/tutorial/introduction.html#strings, look for
"slice")
HTH, v.
PS. If you think it is really useful, vector<shared_ptr<Engine> > can be
wrapped specially to mimick all list operators, it would just be some
work that I can't do ATM.
Follow ups
References