[Python-Dev] cpython: Refactor importlib to make it easier to re-implement in C. (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Feb 23 16:43:59 CET 2012
- Previous message: [Python-Dev] The ultimate question of life, the universe, and everything
- Next message: [Python-Dev] cpython: Refactor importlib to make it easier to re-implement in C.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 23 Feb 2012 16🔞19 +0100 brett.cannon <python-checkins at python.org> wrote:
def sanitycheck(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.
- Previous message: [Python-Dev] The ultimate question of life, the universe, and everything
- Next message: [Python-Dev] cpython: Refactor importlib to make it easier to re-implement in C.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]