On Thu, 09 Jan 2014 03:54:13 +0000
MRAB <pyt...@mrabarnett.plus.com> wrote:
> I'm thinking that the "i" format could be used for signed integers and
> the "u" for unsigned integers. The width would be the number of bytes.
> You would also need to have a way of specifying the endianness.
> 
> For example:
> 
>  >>> b'{:<2i}'.format(256)
> b'\x01\x00'
>  >>> b'{:>2i}'.format(256)
> b'\x00\x01'

The goal is not to add an alternative to the struct module. If you need
binary packing/unpacking, just use struct.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to