Mark Dickinson added the comment: What's wrong with:
if not isinstance(data, basestring): raise TypeError(...) ? In any case, you appear to be wanting to use assert to check user input. That's not its intended use; instead, it's there for making debugging assertions. Bear in mind that when running in optimized mode (with python -O), Python won't execute those asserts at all. (See http://docs.python.org/3.4/reference/simple_stmts.html#the-assert-statement for more.) I think this should be rejected. ---------- nosy: +mark.dickinson versions: +Python 3.4 -Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18642> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com