[Numpy-discussion] Remove numpy/compat/_inspect.py ?

Charles R Harris charlesr.harris at gmail.com
Fri Aug 1 10:23:39 EDT 2014

On Fri, Aug 1, 2014 at 7:59 AM, Robert Kern <robert.kern at gmail.com> wrote:

> On Fri, Aug 1, 2014 at 2:54 PM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> > Importing inspect looks to take about  500 ns on my machine. Although It
> is
> > hard to be exact, as I suspect the file is sitting in the file cache.
> Would
> > probably be slower with hard disks.
> Or where site-packages is on NFS.
> > But as the inspect module is already
> > imported elsewhere, the python interpreter should also have it cached.
> Not on a normal import it's not.
> >>> import numpy
> >>> import sys
> >>> sys.modules['inspect']
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> KeyError: 'inspect'

There are two lazy imports of inspect.

> You should feel free to remove whatever parts of `_inspect` are not
> being used and to move the parts that are closer to where they are
> used if you feel compelled to. Please do not replace the current uses
> of `_inspect` with `inspect`.

It is used in just one place. Is importing inspect so much slower than all
the other imports we do?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140801/db3714f3/attachment.html>

More information about the NumPy-Discussion mailing list