Guido van Rossum added the comment:

Well, msg171804 makes it a much bigger project than the feature that Twisted 
actually needs.  Quoting:

* The default formatting should not use str(), but buffer protocol.
Fine.

* There is no place for floating point.
Actually they do need it -- and it's trivial to define, since fp only returns 
ASCII characters.

* There is no place for locale.
Agreed.

* There is no place for 'r' conversion (possible only for 'a').
Agreed.

* It should include the features of struct.pack(), int.to_bytes() and ctypes.
Not needed.

* Padding should be not only by space, but also by zeros (and possibly by other 
values).
Not needed.

* Alignment (padding to position divisible by some number).
Not needed.

* In addition to padding and truncating should be the ability to raise an 
exception in case of discrepancy between the needed and actual lengths.
Not needed.

* It unlikely needed attribute access and indexing.
I don't know, but these features certainly would be well-defined.

* Builtin format() should not work with this.
Fine.

Probably bytes.format() should not try to call v.__format__(); if an extension 
mechanism is needed it would be called something else, but given the limited 
set of types needed I think this can be skipped.

The most important requirement from Twisted is actually that it is called 
.format(), and that the overall format strings look like they did for 8-bit 
string formatting in Python 2.  In particular b'a{}b{}c'.format(x, y), where x 
and y are bytes, should be equivalent to b'a' x + b'b' + y + b'c'.

----------

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

Reply via email to