On Jan 27, 2009, at 4:23 PM, Ryan May wrote:
I definitely wouldn't advocate magic by default, but I think it would be nice to be able to get the functionality if one wanted to.
OK. Put on the TODO list.
There is one problem I noticed, however. I found common_type and lib.mintypecode, but both raise errors when trying to find a dtype to match both bool and float. I don't know if there's another function somewhere that would work for what I want.
I'm not familiar with these functions, I'll check that.
Apparently, I get my error as a result of my use of titles in the dtype to store an alternate name for the field. (If you're not familiar with titles, they're nice because you can get fields by either name, so for the following example, a['a'] and a['A'] both return array([1]).) The following version of your case gives me the ValueError:
Ah OK. You found a bug. There's a frustrating feature of dtypes: dtype.names doesn't always match [_[0] for _ in dtype.descr].
As a side question, do you have some local mods to your numpy SVN so that some of the functions in recfunctions are available in numpy's top level?
Probably. I used the develop option of setuptools to install numpy on a virtual environment.
On mine, I can't get to them except by importing them from numpy.lib.recfunctions. I don't see any mention of recfunctions in lib/__init__.py.
Well, till some problems are ironed out, I'm not really in favor of advertising them too much...