[issue16566] Structure._anonymous_ should not allow strings

Nick Coghlan report at bugs.python.org
Wed Nov 28 02:32:05 CET 2012


Nick Coghlan added the comment:

Yes, if you pass "string" when you meant to pass ["string"], you will often get awful error messages.

This is one of the downsides of strings being iterable, but we're not going to add "if isinstance(obj, str): throw TypeError(msg)" special cases everywhere to address it.

It's definitely a wart in Python, but it's one Python developers just have to get used to (and learn to suspect whenever they see a single-character string in an error message).

----------
nosy: +ncoghlan
resolution:  -> wont fix
status: open -> closed

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


More information about the Python-bugs-list mailing list