[issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does

2018-10-03 Thread Benjamin Peterson
Benjamin Peterson added the comment: It may be acceptable to allow for byteorder="native", but making the default native will make it too easy for people to write code that works great on their machine but not machines with the opposite endianess. Byte order is something you should explicitl

[issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does

2018-10-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: to_bytes and from_bytes aren't remotely related to native primitive types, struct is. If the associated lengths aren't 2, 4 or 8, there is no real correlation with system level primitives, and providing these defaults makes it easy to accidentally write non-

[issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does

2018-10-03 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +9081 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does

2018-10-03 Thread Alex Henrie
New submission from Alex Henrie : When serializing a single integer, int.to_bytes and int.from_bytes are more efficient alternatives to struct.pack and struct.unpack. However, struct.pack and struct.unpack currently have the advantage that the byteorder does not have to be specified (because