Message282707
(The "Components" selection might be wrong, I wasn't sure what to use)
As https://docs.python.org/3.6/library/string.html
> Three conversion flags are currently supported: '!s' which calls str() on the value, '!r' which calls repr() and '!a' which calls ascii().
It would be great if further conversation flags were added for more built-in methods. In particular:
* '!l' for len()
* '!i' for id()
(There might be others but these are the two I would find most useful.)
format() is now very powerful, but it's very common for strings, lists, dicts, sets etc. to want to include their length in strings. This is currently ugly.
This enhancement will be even more sought after with string literals in python 3.6.
Example of when this would be very useful:
v = {'type': 'whatever, 'items': ['foo', 'bar', 'spam']}
'{type}{items!l}'.format(**v)
Would also be very useful with getattr, and getitem usage. |
|
Date |
User |
Action |
Args |
2016-12-08 14:37:06 | samuelcolvin | set | recipients:
+ samuelcolvin |
2016-12-08 14:37:06 | samuelcolvin | set | messageid: <1481207826.64.0.85637037523.issue28904@psf.upfronthosting.co.za> |
2016-12-08 14:37:06 | samuelcolvin | link | issue28904 messages |
2016-12-08 14:37:06 | samuelcolvin | create | |
|