You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
``stdlib_list.in_stdlib`` provides an efficient way to check if a module name is part of stdlib.
25
+
It relies on ``@lru_cache`` to cache the stdlib list and query results for similar calls. Therefore it is much more efficient than ``module_name in stdlib_list()`` especially if you wish to perform multiple checks.
26
+
27
+
In particular:
28
+
29
+
::
30
+
31
+
>>> from stdlib_list import in_stdlib
32
+
>>> in_stdlib('zipimport') # built in
33
+
True
34
+
>>> in_stdlib('math') # C-API stdlib module, but linked as extension (on my machine)
35
+
True
36
+
>>> in_stdlib('numpy') # C-API extension, not stdlib
37
+
False
38
+
>>> in_stdlib('sys') # built-in (and special)
39
+
True
40
+
>>> in_stdlib('os') # Python code in stdlib
41
+
True
42
+
>>> in_stdlib('requests') # Python code, not stdlib
0 commit comments