On Thu, 23 Feb 2012 16:18:19 +0100 brett.cannon <python-check...@python.org> wrote: > def _sanity_check(name, package, level): > """Verify arguments are "sane".""" > + if not hasattr(name, 'rpartition'): > + raise TypeError("module name must be str, not {}".format(type(name)))
Why don't you simply use isinstance()? (bytes objects also have rpartition()) Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com