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 PyCall (e.g. by pyobject["X"] = X) is by reference (i.e. it wraps a numpy array around the same data). However, converting an array from Python back to Julia defaults to making a copy, unless you explicitly use a PyArray, as in PyArray(pyobj["X"]). > Now Xpy is really a reference to the array I want to manipulate. How can > I now "reinterpret" Xpy (i.e. the block of memory) as a Julia Array, or > other Julia data structure - specifically I want a Vector of FixedSizeArray > ? > Why do you need an Array? Why not just use the PyArray as-is?