-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
Description
Feature
The fill and align string format specifiers do not currently have type checking, but are not supported by all types. Specifically, None
does not support them.
Pitch
I ran into a bug where an optional type was being passed to string formatting using <
. This would succeed most of the time, but error if the value was None:
>>> "{:<2}".format(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to NoneType.__format__
It would be great if mypy would catch this code as a type violation.
I attempted to implement here: #18799 but this was more challenging than I anticipated and I am a first time contributor.
Thanks.