Message316081
The problem is that type.__format__ doesn't exist, so object.__format__ is being called, and it throws an error if you provide a format spec. This is done for future expansion: if we do want to add type.__format__ in the future, we don't have to worry about existing cases that are using format specs that might not work with the new type.__format__.
No format spec is the same as calling str() on the argument and returning that, which is what is happening in your working examples.
If you want to apply a str formatting spec, you should covert the argument to a str first, using either !s or str():
>>> print('{a!s: >10}'.format(a=type(a)))
<class 'str'>
>>> print('{a: >10}'.format(a=str(type(a))))
<class 'str'> |
|
Date |
User |
Action |
Args |
2018-05-02 17:06:33 | eric.smith | set | recipients:
+ eric.smith, abarry, alexomics |
2018-05-02 17:06:33 | eric.smith | set | messageid: <1525280793.25.0.682650639539.issue33410@psf.upfronthosting.co.za> |
2018-05-02 17:06:33 | eric.smith | link | issue33410 messages |
2018-05-02 17:06:33 | eric.smith | create | |
|