[New-bugs-announce] [issue45165] alighment format for nullable values

Anthony Sottile report at bugs.python.org
Fri Sep 10 11:10:56 EDT 2021

New submission from Anthony Sottile <asottile at umich.edu>:

currently this works correctly:

>>> '%8s %8s' % (None, 1)
'    None        1'

but conversion to f-string fails:

>>> f'{None:>8} {1:>8}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to NoneType.__format__

my proposal is to implement alignment `__format__` for `None` following the same as for `str` for alignment specifiers

components: Interpreter Core
messages: 401582
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: alighment format for nullable values
type: behavior
versions: Python 3.10, Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list