Re: [Python-Dev] cpython: Refactor importlib to make it easier to re-implement in C.

2012-02-23 Thread Brett Cannon
On Thu, Feb 23, 2012 at 10:43, Antoine Pitrou wrote: > On Thu, 23 Feb 2012 16:18:19 +0100 > brett.cannon wrote: > > def _sanity_check(name, package, level): > > """Verify arguments are "sane".""" > > +if not hasattr(name, 'rpartition'): > > +raise TypeError("module name must be

Re: [Python-Dev] cpython: Refactor importlib to make it easier to re-implement in C.

2012-02-23 Thread Antoine Pitrou
On Thu, 23 Feb 2012 16:18:19 +0100 brett.cannon 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 isinsta