original) (raw)
(On Mon, Jan 6, 2014 at 8:44 AM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Hi,
I think we must either implement both or none of them.
On Mon, 6 Jan 2014 14:24:50 +0100
Victor Stinner <victor.stinner@gmail.com> wrote:
\>
\> The PEP is a draft with open questions. First, I'm not sure that both
\> bytes%args and bytes.format(args) are needed. The implementation of
\> .format() is more complex, so why not only adding bytes%args?
Or bytes.format() only. But I do agree that only implementing the % operator is the wrong answer.
-Brett
Not desirable IMHO. bytes formatting should serve mainly for templating
\> 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?
situations (i.e. catenate and insert bytestrings into one another). We
cannot start giving text-like semantics to bytes objects without
confusing non-experts.
Yes, bytes formatting must support the same calling conventions as str
\> \* format keywords? \`\`b'{arg}'.format(arg=5)\`\`
\> \* \`\`str % dict\`\` ? \`\`b'%(arg)s' % {'arg': 5)\`\`
formatting.
BTW, there's a subtlety here: \`\`%s\`\` currently means "insert the result
of calling \_\_str\_\_", but bytes formatting should \*not\* call \_\_str\_\_.
No, IMHO.
\> \* Floating point number?
\> \* \`\`%i\`\`, \`\`%u\`\` and \`\`%d\`\` formats for integer numbers?
\> \* Signed number? \`\`%+i\`\` and \`\`%-i\`\`
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/brett%40python.org