Movatterモバイル変換


[0]ホーム

URL:


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

Antoine Pitrousolipsis at pitrou.net
Thu Feb 23 16:43:59 CET 2012


On Thu, 23 Feb 2012 16:18:19 +0100brett.cannon <python-checkins at 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())RegardsAntoine.


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp