<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 1, 2014 at 7:03 AM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Fri, Aug 1, 2014 at 6:37 AM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Aug 1, 2014 at 12:57 PM, Charles R Harris<br>
<div><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>> wrote:<br>
><br>
> On Thu, Jul 31, 2014 at 11:46 PM, David Cournapeau <<a href="mailto:cournape@gmail.com" target="_blank">cournape@gmail.com</a>><br>
> wrote:<br>
>><br>
>> The docstring at the beginning of the module is still relevant AFAIK: it<br>
>> was about decreasing import times. See<br>
>> <a href="http://mail.scipy.org/pipermail/numpy-discussion/2009-October/045981.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/2009-October/045981.html</a><br>
>><br>
>><br>
>> On Fri, Aug 1, 2014 at 10:27 AM, Charles R Harris<br>
>> <<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>> wrote:<br>
>>><br>
>>> Hi All,<br>
>>><br>
>>> The _inspect.py function looks like a numpy version of the python inspect<br>
>>> function. ISTR that is was a work around for problems with the early python<br>
>>> versions, but that would have been back in 2009.<br>
>>><br>
>>> Thoughts?<br>
>>><br>
><br>
> It's only used in one function.<br>
<br>
</div>Yes, one function that is called at startup, so no, a local import of<br>
the stdlib inspect module would not help.<br>
<div><br>
> def get_object_signature(obj):<br>
>     """<br>
>     Get the signature from obj<br>
>     """<br>
>     try:<br>
>         sig = formatargspec(*getargspec(obj))<br>
>     except TypeError as errmsg:<br>
>         sig = ''<br>
> #        msg = "Unable to retrieve the signature of %s '%s'\n"\<br>
> #              "(Initial error message: %s)"<br>
> #        warnings.warn(msg % (type(obj),<br>
> #                             getattr(obj, '__name__', '???'),<br>
> #                             errmsg))<br>
>     return sig<br>
><br>
> Where a local import would do as well. It also has bugs, so evidently isn't<br>
> called often ;)<br>
<br>
</div>What bugs? Any bugs relevant to the objects that<br>
get_object_signature() is called with? It does not have to work for<br>
anything else but those.<br></blockquote><div><br></div></div></div><div>Undefined variables in getargs. The only two functions used from the module are very small and could simply be brought into `ma/core.py`. The python inspect module is used elsewhere...<br>
</div></div></div></div></blockquote><div><br></div><div>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. But as the inspect module is already imported elsewhere, the python interpreter should also have it cached.<br>
<br></div><div>Chuck<br></div></div></div></div>