Sebastian Haase wrote:
> I just found this in  myCVS/numpy/numpy/core/tests/test_numerictypes.py
> <code>
>   
> def normalize_descr(descr):
>     "Normalize a description adding the platform byteorder."
>
>   return out
> </code>
>   

> Is that what I was talking about !?  It's quite a big animal. 
> Would this be needed "everytime" I want to get a "systembyte-ordered version" 
> of a given type !?
>   

No, I'm not even sure why exactly that was written but it's just in the 
testing code.  I think the email I sent yesterday got lost because I 
sent it CC: numpy-discussion with no To: address.

Here's what I said (more or less) in that email:

You can use the .newbyteorder(endian='s') method of the dtype object to 
get a new data-type with a different byteorder.  The possibilities for 
endian are 'swap', 'big' ('>'), 'little' ('<'), or 'native' ('='). 

This will descend down a complicated data-type and change all the 
byte-orders appropriately.

Then you can use .astype(newtype) to convert to the new byteorder.

The .isnative attribute of the data-type will tell you if the data-type 
(or all of it's fields in recent SVN) are in native byte-order.


-Travis









-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to