New submission from Gawain Bolton <gawain.bol...@gmail.com>:
Python 2.7.16 (default, Apr 6 2019, 01:42:57) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print('{:^10}'.format(None)) None However this does not work with Python3: Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print('{:^10}'.format(None)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported format string passed to NoneType.__format__ Given that the None type is output as a string, it makes sense for string formatting options to be usable with it. It also makes code less fragile and avoids having to write special cases for when values could be None. ---------- components: Library (Lib) messages: 341355 nosy: Gawain Bolton priority: normal severity: normal status: open title: Python3 regresison: String formatting of None object type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36787> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com