Марк Коренберг added the comment:

1. I forgot to say: since I add new items to `if.. elif...elif.....` chain 
after testing for 'big' and 'little', this change will not slowdown current 
external code.
2. Well, slowdown of to_bytes() between 'big' and 'net' on my PC give about 3 
percents.
3. to_bytes(2, sys.byteorder) is timed exactly as 'host'.


./python -m timeit -s 'import sys' -n 10000000 '(1234).to_bytes(2, 
sys.byteorder)' # iteration counter is required to stabilize results.

4. As I think, Python should also be simple and intuitive. If everyone thinks 
as those, who set (-1) on this issue, we will neve add 
.to_bytes()/.from_bytes(), since there are already TWO (!) modules to do 
conversion to/from bytes: `ctypes` 
(https://docs.python.org/3/library/ctypes.html#ctypes.BigEndianStructure) and 
`struct`. Answer is: it is unsuitable and not comfort for the programmer. Why 
not to make really good practical API ?

And also, I want to call @gvanrossum.. I'm disappointed. This change is so 
obvious thing, that I don't understand how to explain...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27638>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to