It is possible to create variable for some engine (any python exposed class) instead of assigning it.

If one does not use labels, he can write for example O.engines[2].avoidSelfInteractionMask = 1 only to create a new variable for that engine instead of changing the value for InsertionSortCollider. We know that python cannot complain that a "variable does not exist". It simply creates a new one. There were at least two or three questions about that on launchpad.

But in fact on C++ side we have full python introspection capabilities. We can for example before the first invocation of O.run scan the engines, maybe even bodies, and throw an error when a non-C++ (only python-side) variable is detected.

We could throw on any unrecognized variable, except for example pyVars. Then if anyone wanted to attach a python variable to a C++ object, he would attach it under pyVars, for example O.engines[2].pyVars.whatever. Any other assignment would throw an error. The only problem is that the check cannot be done during assignment - this operation is transparent to C++. The check can be only done if explicitly invoked. For example perform this check on first O.run call.

Edited by Janek Kozicki