diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-02-03 20:01:07 +0100 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-02-11 19:30:21 +0100 |
commit | 2facd5cbdcaa08b61270c0c0760a39cd03acc007 (patch) | |
tree | 7001911b928ecc830184633e209bd052073d6895 /numpy/doc/byteswapping.py | |
parent | b7850701a31127cad8c7399cea6be9cd5f71bec5 (diff) | |
download | numpy-2facd5cbdcaa08b61270c0c0760a39cd03acc007.tar.gz |
ENH: add tobytes and stop using tostring in documentation
tostring returns bytes which are not equal to string, so provide a
tobytes function alias.
tostring does not emit a deprecation warning yet so rdepends do not need
to check two names to support older versions of numpy without warnings.
Diffstat (limited to 'numpy/doc/byteswapping.py')
-rw-r--r-- | numpy/doc/byteswapping.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/doc/byteswapping.py b/numpy/doc/byteswapping.py index ffefe3168..430683d30 100644 --- a/numpy/doc/byteswapping.py +++ b/numpy/doc/byteswapping.py @@ -101,7 +101,7 @@ the correct endianness: Note the the array has not changed in memory: ->>> fixed_end_dtype_arr.tostring() == big_end_str +>>> fixed_end_dtype_arr.tobytes() == big_end_str True Data and type endianness don't match, change data to match dtype @@ -117,7 +117,7 @@ that needs a certain byte ordering. Now the array *has* changed in memory: ->>> fixed_end_mem_arr.tostring() == big_end_str +>>> fixed_end_mem_arr.tobytes() == big_end_str False Data and dtype endianness match, swap data and dtype @@ -131,7 +131,7 @@ the previous operations: >>> swapped_end_arr = big_end_arr.byteswap().newbyteorder() >>> swapped_end_arr[0] 1 ->>> swapped_end_arr.tostring() == big_end_str +>>> swapped_end_arr.tobytes() == big_end_str False An easier way of casting the data to a specific dtype and byte ordering @@ -140,7 +140,7 @@ can be achieved with the ndarray astype method: >>> swapped_end_arr = big_end_arr.astype('<i2') >>> swapped_end_arr[0] 1 ->>> swapped_end_arr.tostring() == big_end_str +>>> swapped_end_arr.tobytes() == big_end_str False """ |