On 01/06/2014 09:50 AM, Xavier Morel wrote: > On 2014-01-06, at 14:44 , Antoine Pitrou <solip...@pitrou.net> wrote: >>> Then, >>> the following points must be decided to define the complete list of >>> supported features (formatters): >>> >>> * Format integer to hexadecimal? ``%x`` and ``%X`` >>> * Format integer to octal? ``%o`` >>> * Format integer to binary? ``{!b}`` >>> * Alignment? >>> * Truncating? Truncate or raise an error? >> >> Not desirable IMHO. bytes formatting should serve mainly for templating >> situations (i.e. catenate and insert bytestrings into one another). We >> cannot start giving text-like semantics to bytes objects without >> confusing non-experts. > > But having at least some of struct's formatting options available on > bytes.format or bytes % would be useful.
Perhaps, but the PEP's stated goal is to make porting between 2.x and 3.5 easier. Add struct formatting to 3.5 wouldn't help. Eric. _______________________________________________ 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