This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexomics
Recipients alexomics
Date 2018-05-02.14:22:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525270930.67.0.682650639539.issue33410@psf.upfronthosting.co.za>
In-reply-to
Content
When trying to print a type in a formatted string with padding TypeError is raised. See examples below.

These work:
>>> a = 'abc'
>>> print('{a}'.format(a=type(a)))
<class 'str'>
>>> print('{a}'.format(a=str(type(a))))
<class 'str'>

These don't:
>>> print('{a: >10}'.format(a=type(a)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to type.__format__
>>> t = type(a)
>>> print('{a: >10}'.format(a=t))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to type.__format__
History
Date User Action Args
2018-05-02 14:22:10alexomicssetrecipients: + alexomics
2018-05-02 14:22:10alexomicssetmessageid: <1525270930.67.0.682650639539.issue33410@psf.upfronthosting.co.za>
2018-05-02 14:22:10alexomicslinkissue33410 messages
2018-05-02 14:22:10alexomicscreate