[Python-Dev] [Python-checkins] cpython: quote the type name for improved readability

Nick Coghlan ncoghlan at gmail.com
Wed Nov 9 11:47:55 CET 2011


On Wed, Nov 9, 2011 at 8:19 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Wed, 09 Nov 2011 10:44:50 +0100
> "Martin v. Löwis" <martin at v.loewis.de> wrote:
>> I recommend reverting the change. I fail to see why quoting the name
>> improves readability.
>
> It does if the name is "Throatwobbler Mangrove".

The readability argument doesn't really sell me, but the consistency one does:

Python 3.2:
>>> iter(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
>>> next(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: int object is not an iterator

We generally do quote the type names in error messages, so this change
is just bringing next() into line with other operations:

>>> 1 + ''
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list