Best practise to transfer object characteristics

On 09/05/2018 at 16:52, xxxxxxxx wrote:

Hi folks,

usually there are different ways to perform a task and sometimes I'm unsure which one to prefer.

E.g. like these two ways to transfer the rotation from one object to another in Python.

Way 1:


Way 2:


The outcome is the same here but is one way better than the other and why (e.g. performance-wise)?

I'd intuitionally tend to the first method but I'm not absolutely sure if it is really superior to way 2.

Any hints?

Kind regards,

On 09/05/2018 at 19:10, xxxxxxxx wrote:

This is covered some on a cineversity wiki page, although it doesn't use the exact examples you have:

They don't get into object methods like SetRelRot(), so it'd still be interesting to find out if there's a big difference there.

On 10/05/2018 at 02:53, xxxxxxxx wrote:


The fastest way is the first with SetRelRot().

darby linked an interesting page on Cineversity wiki, where there's a nice explanation why using the subscript operator [] is slower.

In the end, performance isn't so important for most scripters and using [] isn't wrong for object's parameters.

On 10/05/2018 at 06:08, xxxxxxxx wrote:

Hi Darby and Yannick,

thank you both of you, also for the wiki link.
So I had the right feeling indeed. 😉

Kind regards,