Basically I am using the C++ API of an app, but there is no reference for its python access. One variable is passed by ref, like so:
GetPoint ( Point &p, Object obj )
so how can I translate to Python? Is there a pass by ref symbol?
There is no pass by reference symbol in Python.
Just modify the passed in point, your modifications will be visible from the calling function.
>>> def change(obj):
... obj.x = 10
...
>>> class Point(object): x,y = 0,0
...
>>> p = Point()
>>> p.x
0
>>> change(p)
>>> p.x
10
...
So I should pass it like: GetPoint (p, obj)?
Yes, though Iraimbilanja has a good point. The bindings may have changed the call to return the point rather than use an out parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With