[NumPy-Tickets] [NumPy] #1701: Accessing Type Conversion/Promotion/Coercion Rules
NumPy Trac
numpy-tickets@scipy....
Tue Jan 4 21:48:51 CST 2011
#1701: Accessing Type Conversion/Promotion/Coercion Rules
-------------------------+--------------------------------------------------
Reporter: pv00 | Owner: somebody
Type: defect | Status: reopened
Priority: normal | Milestone: 2.0.0
Component: numpy.core | Version: 1.5.0
Resolution: | Keywords: dtype
-------------------------+--------------------------------------------------
Comment(by pv00):
def make_new_array(ndarrayOfArbitraryShape_A, ndarrayOfArbitraryShape_B):
new_dtype = common_dtype(ndarrayOfArbitraryShape_A.dtype, \
ndarrayOfArbitraryShape_B.dtype)
new_array = numpy.zeros(BigShape, dtype=new_dtype)
return new_array
is there a better way than the ugly and awkward:
def common_dtype(A,B):
return (numpy.zeros((1),dtype=B.dtype) +
numpy.zeros((1),dtype=A.dtype)).dtype
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1701#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list