Closed syrte closed 9 years ago
Two queqstions:
sa = sharedmem.asarray(a)
do more than
sa = sharedmem.copy(numpy.asarray(a))
Sorry, I didn't notice the function copy
, so asarray
is not necessary.
And I agree that the function name copy
is better.
sa = sharedmem.asarray(a)
is just the same as sa = sharedmem.copy(numpy.asarray(a))
,
only difference is you don't convert a
to numpy array first when a
is a list or something similar.
numpy.asarray
can convert any array-like object to numpy array,
and sharedmem.asarray
would convert (copy actually) array-like object to sharedmem array.
In this sense I think the name asarray
is suit for this function.
It may not be worthwhile to avoid the first conversion from a list. the argument goes:
OK, I agree.
For the function copy
is a better name, as it would always create a new buffer.
Add a function
asarray
which can create a shared memory copy of given array. It's useful for who wants to share existing array to multi-processes.