← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2314: making TriaxialStressController more python friendly.

 

> BTW, I was (again) confused about using stress() or getStress(). We
> should agree on one policy for getters/setters, and use it
> EVERYWHERE. My script didn't work at first becuase I was trying to
> call getStress() which is not exposed to python.

You don't need any getters/setters in python.
Use .add_property("foo",&YourClass::getFoo,"doc")
or .add_property("foo",&YourClass::getFoo,&YourClass::setFoo,"doc") to
create read-only or read-write object.foo thing (object.foo=something
will raise an exception if it is read-only).

If you were talking about c++, then you're probably right, although here
is just a few gettes/setters and they are located a few lines away from
the .add_property in the same class.

v. 





References