<div dir="ltr">Well, the method will have to be present on all ndarrays, since structured arrays do not have a different type from regular arrays, only a different dtype. Thus the attribute has to be present regardless, but some Exception will have to be raised depending on the dtype, to make it quack like the kind of duck it is, so to speak. Indeed it seems like an atypical design pattern; but I don't see a problem with it.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 1, 2014 at 4:08 PM, John Zwinck <span dir="ltr"><<a href="mailto:jzwinck@gmail.com" target="_blank">jzwinck@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"><div><div class="h5"><p dir="ltr">On 1 Oct 2014 04:30, "Stephan Hoyer" <<a href="mailto:shoyer@gmail.com" target="_blank">shoyer@gmail.com</a>> wrote:<br>
><br>
> On Tue, Sep 30, 2014 at 1:22 PM, Eelco Hoogendoorn <<a href="mailto:hoogendoorn.eelco@gmail.com" target="_blank">hoogendoorn.eelco@gmail.com</a>> wrote:<br>
>><br>
>> On more careful reading of your words, I think we agree; indeed, if keys() is present is should return an iterable; but I don't think it should be present for non-structured arrays.<br>
><br>
> Indeed, I think we do agree. The attribute can simply be missing (e.g., accessing it raises AttributeError) for non-structured arrays. </p>
</div></div><p dir="ltr">I'm generally fine with this, though I would like to know if there is precedent for methods being present on structured arrays only.  Even if there is no precedent I am still OK with the idea, I just think we should understand if how novel this will be.</p>
</div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>