<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 2, 2013 at 8:12 PM, Ralf Gommers <span dir="ltr"><<a href="mailto:ralf.gommers@gmail.com" target="_blank">ralf.gommers@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Mon, Apr 1, 2013 at 2:27 PM, Todd <span dir="ltr"><<a href="mailto:toddrjen@gmail.com" target="_blank">toddrjen@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br>There were a number of other ideas in this thread:<br><br>

<a href="http://mail.scipy.org/pipermail/numpy-discussion/2013-March/065699.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/2013-March/065699.html</a><br>



</div></div></blockquote><div><br></div></div></div><div>Thanks Todd. Your idea 5 is pretty much what Nathaniel just detailed out, it's on the ideas page now. That should enable idea 1 as well. The other idea that got some positive feedback was 3: <a href="http://mail.scipy.org/pipermail/numpy-discussion/2013-March/065710.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/2013-March/065710.html</a>. If you or someone else could make that a little more concrete, we can put that up.<span class=""><font color="#888888"><br>


</font></span></div></div><span class=""><font color="#888888"></font></span></div></div><br></blockquote><div> </div></div>For 3:<br><br></div><div class="gmail_extra">With structured arrays, you can access them by name (key) in a manner identical to dictionaries:<br>

<br></div><div class="gmail_extra">y = x['f']<br><br></div><div class="gmail_extra">It also has a method for accessing the list of names (keys):<br><br></div><div class="gmail_extra">x.dtype.names<br><br></div><div class="gmail_extra">

This should be maintained for backwards-compatibility, but these methods should also be added:<br><br>x.keys -- returns a list of field names</div><div class="gmail_extra">x.values -- returns a list of views into the array, one for each structure<br>

</div><div class="gmail_extra">x.items -- returns a list of tuple containing name/structure pairs (the structures being a views)<br><div class="gmail_extra">x.iterkeys/itervalues/iteritems -- returns an iterable over the corresponding objects (should not be available in python 3)<br>

</div><div class="gmail_extra">x.viewkeys/viewvalues/viewitems -- the same as the corresponding item, since they always return views (should not be available in python 3)</div></div><div class="gmail_extra">x.has_key -- tests if a field name is present (should not be available in python 3, should use "key in x.keys()")<br>

</div><div class="gmail_extra">x.get -- get a field by name, returning a default array (an empty array by default) if not present</div><div class="gmail_extra">x.update -- copy values into the matching key from another structured array, a dict, or list of key/value tuples.  Unlike dicts this will only work for keys that are already present.<br>

</div><div class="gmail_extra"><br></div><div class="gmail_extra">Documentation should probably be updated to have these as the default ways of interacting with structured arrays, with the old methods deprecated.  "Names" should also probably be renamed "keys" for compatibility with dicts.<br>

</div></div>