[Python-Dev] [Python-checkins] cpython: quote the type name for improved readability
Stefan Behnel
stefan_ml at behnel.de
Mon Nov 7 18:46:25 CET 2011
Éric Araujo, 07.11.2011 18:24:
>> http://hg.python.org/cpython/rev/bbc929bc2224
>
>> user: Philip Jenvey<pjenvey at underboss.org>
>> summary:
>> quote the type name for improved readability
>>
>> files:
>> Python/bltinmodule.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>>
>> diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
>> --- a/Python/bltinmodule.c
>> +++ b/Python/bltinmodule.c
>> @@ -1121,7 +1121,7 @@
>> return NULL;
>> if (!PyIter_Check(it)) {
>> PyErr_Format(PyExc_TypeError,
>> - "%.200s object is not an iterator",
>> + "'%.200s' object is not an iterator",
>> it->ob_type->tp_name);
>> return NULL;
>> }
>
> What about displaying the repr of the type object?
While I agree that this is more readable, quoted type names are rather rare
if not pretty much unprecedented in core exception messages, so this is
definitely not the only place that would need changing.
However, note that arbitrarily changing exception messages always breaks
someone's doctests, so my personal preference would be to keep it as it was.
Stefan
More information about the Python-Dev
mailing list