Martin Panter <vadmium...@gmail.com> added the comment:
Code in question: try: # non-sequence items should not work with len() # non-empty strings will fail this if len(query) and not isinstance(query[0], tuple): raise TypeError # [. . .] except TypeError: ty, va, tb = sys.exc_info() raise TypeError("not a valid non-string sequence " "or mapping object").with_traceback(tb) It is not redundant if you want a specific error message. I think that is the point of the code, to indicate the problem to the programmer. So the message is meant to be useful. I can think of three cases: >>> urlencode(None) # Non-sequence TypeError: not a valid non-string sequence or mapping object >>> urlencode({'sized but not indexable'}) TypeError: not a valid non-string sequence or mapping object >>> urlencode('item [0] not a tuple') TypeError: not a valid non-string sequence or mapping object ---------- nosy: +martin.panter _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35447> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com