[issue14723] Misleading error message for str.format()

Mark Theisen report at bugs.python.org
Fri May 4 20:21:12 CEST 2012


New submission from Mark Theisen <mark.theisen at digitecinc.com>:

When I run this code: '{0:i}'.format(None)

I get this error:
ValueError: Unknown format code 'i' for object of type 'str'

This seems misleading because None is of Type 'NoneType'. I was expecting the error to say something to the effect of:
Unknown format code 'i' for object of type 'NoneType'

----------
components: Interpreter Core
messages: 159955
nosy: theisenm
priority: normal
severity: normal
status: open
title: Misleading error message for str.format()
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14723>
_______________________________________


More information about the Python-bugs-list mailing list