<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hello all, 
<div><br>
</div>
<div>I was looking to wrap hasattr in a numpy ufunc and got some weird behavior.  </div>
<div><br>
</div>
<div>Here is a transcript:</div>
<div>
<div>
<div>In [5]: import numpy as np</div>
<div>In [6]: np.__version__</div>
<div>Out[6]: '1.6.2'</div>
<div>In [7]: b = [1,2,3]</div>
<div>In [7]: nphas = np.frompyfunc(hasattr, 2, 1)</div>
<div>In [8]: hasattr(b, 'extend')</div>
<div>Out[8]: True</div>
<div>In [9]: nphas(b, 'extend')</div>
<div>Out[9]: NotImplemented</div>
<div>In [10]: nphas(b, ['extend']*2)</div>
<div>Out[10]: NotImplemented</div>
<div>
<div>In [11]: type(nphas(b, ['extend']*2))</div>
<div>Out[11]: NotImplementedType</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>This isn't an exception but an object returned, what what or why is not implemented?</div>
<div><br>
</div>
<div>What I really want to do is be able to run hasattr like isinstance is run, isinstance(b, (list, str))</div>
<div><br>
</div>
<div><br>
</div>
<div>Anyone have any thoughts/advice here?</div>
<div><br>
</div>
<div>Cheers, </div>
<div><br>
</div>
<div>Brian</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<div><br class="Apple-interchange-newline">
<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>-- <br>
<br>
Brian A. Larsen<br>
ISR-1 Space Science and Applications<br>
Los Alamos National Laboratory</div>
<div>PO Box 1663, MS-D466<br>
Los Alamos, NM 87545<br>
USA<br>
<br>
(For overnight add:<br>
SM-30, Bikini Atoll Road)<br>
<br>
Phone: 505-665-7691<br>
Fax:   505-665-7395<br>
email: <a href="mailto:balarsen@lanl.gov">balarsen@lanl.gov</a><br>
<br>
Correspondence /<br>
Technical data or Software Publicly Available<br>
</div>
<div><br>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
</div>
</div>
</body>
</html>