I first proposed this on GitHub:
https://github.com/numpy/numpy/issues/5134 ; jaimefrio requested that
I bring it to this list for discussion.
My proposal is to add a keys() method to NumPy's array class ndarray.
The behavior would be to return self.dtype.names, i.e. the column
names for a
Sounds fair to me. Indeed the ducktyping argument makes sense, and I have a
hard time imagining any namespace conflicts or other confusion. Should this
attribute return none for non-structured arrays, or simply be undefined?
On Tue, Sep 30, 2014 at 12:49 PM, John Zwinck jzwi...@gmail.com wrote:
Hello to all.
I'm aiming to wrap a Fortran program into Python. I started to work with
f2py, and am trying to setup a debug mode where I could reach
breakpoints in Fortran module launched by Python. I've been looking in
the existing post, but not seeing things like that.
I'm used to work with
I am also +1. I have already used structured arrays to do keyword-based
string formatting. This makes sense as well. Would this enable keyword
argument expansion?
On Tue, Sep 30, 2014 at 7:29 AM, Eelco Hoogendoorn
hoogendoorn.ee...@gmail.com wrote:
Sounds fair to me. Indeed the ducktyping
I like this idea. But I am -1 on returning None if the array is
unstructured. I expect .keys(), if present, to always return an iterable.
In fact, this would break some of my existing code, which checks for the
existence of keys as a way to do duck typed checks for dictionary like
objects (e.g.,
So a non-structured array should return an empty list/iterable as its keys?
That doesn't seem right to me, but perhaps you have a compelling example to
the contrary.
I mean, wouldn't we want the duck-typing to fail if it isn't a structured
array? Throwing an attributeError seems like the best
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.
On Tue, Sep 30, 2014 at 10:21 PM, Eelco Hoogendoorn
hoogendoorn.ee...@gmail.com wrote:
So a non-structured array
On Tue, Sep 30, 2014 at 1:22 PM, Eelco Hoogendoorn
hoogendoorn.ee...@gmail.com wrote:
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.
Indeed, I think we do