Serhiy Storchaka added the comment:
> How about raising a TypeError if ``all(isinstance(l, str) for l in
> fromlist)`` is False? That would make the exception message less clearer
> since we can't include the "[...] not 'bytes'" part though.
for l in fromlist:
if not isinstance(l, str):
raise TypeError(...)
Note also that you can get an arbitrary error if fromlist is not a sequence.
Actually this issue doesn't look very important for Python 3, since it is
unlikely that non-string is passed in fromlist. Unlike to Python 2 where you
can pass unicode if just use unicode_literals. Other solution for Python 2 is
allowing unicode in fromlist. Perhaps this would increase compatibility with
Python 3.
----------
title: "TypeError: Item in ``from list'' not a string" message -> "TypeError:
Item in ``from list'' not a string" message
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21720>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com