[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Steven G. Johnson
On Friday, September 9, 2016 at 11:47:45 AM UTC-4, Christoph Ortner wrote: > > Because I want to reinterpret it as a Vector of fixed size arrays. Can > this be done with a PyArray directly? (I can't try it out right now) No.

[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Christoph Ortner
Because I want to reinterpret it as a Vector of fixed size arrays. Can this be done with a PyArray directly? (I can't try it out right now)

[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Steven G. Johnson
On Friday, September 9, 2016 at 8:33:09 AM UTC-4, Christoph Ortner wrote: > > It now looks to me like the "problem" is with Python, not with PyCall; I > thought the assignment pyobj.X = X would be by reference, but apparently > it makes a copy ?!? > Converting an array from Julia to Python in

[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Christoph Ortner
To partially answer my own question --- I just hadn't thought of this alternative route before --- the following seems to do it: X = pointer_to_array(Xpy.data, (Xpy.dims[2], Xpy.dims[1]), false) Are there any concerns associated with this other than the risk that Python might free the allocated

[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Christoph Ortner
It now looks to me like the "problem" is with Python, not with PyCall; I thought the assignment pyobj.X = X would be by reference, but apparently it makes a copy ?!? Alternatively, to achieve what I want I could do Xpy = PyArray( pyobj.X ) Now Xpy is really a reference to the array I want t

[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Christoph Ortner
Sorry - I was rushing when I wrote this. What I meant was: after the assignment pyobj["X"] = Xpy, if I modify X in-place, this modification does not seem to propagate to pyobj.X. I will try to put together an example.

[julia-users] Re: Assigning a field in Python via reference

2016-09-09 Thread Steven G. Johnson
On Friday, September 9, 2016 at 2:56:02 AM UTC-4, Christoph Ortner wrote > > (2) convert it to a PyArray (no copy) : > Xpy = PyArray(X) > > > (3) then assign this to a field of an object: > pyobj["X"] = Xpy orpyobj["X"] = Xpy.o or > > The aim is, when I modify X, then the data