Hello all,

I often find myself writing the following code:

    try:
        features = np.asanyarray(features)
    except:
        features = np.asanyarray(features, dtype=object)

I basically want to be able to use fany indexing on features and, in most 
cases, it will be a numpy floating point array. Otherwise, default to having it 
be an array of dtype=object.

Is there a more elegant way to do it with numpy?

Thank you,
-- 
Luis Pedro Coelho | Carnegie Mellon University | http://luispedro.org

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to