[Numpy-discussion] Converting a list
robert.kern at gmail.com
Mon Jul 10 13:41:04 CDT 2006
Pierre GM wrote:
> On Monday 10 July 2006 05:57, Robert Kern wrote:
>> Nils Wagner wrote:
>>> Hi all,
>>> I have a list consisting of arrays of different size
>> The error message is unhelpful, certainly, but the *fact* that an exception
>> is raised is not a bug.
> Attempting to build an array from a list of sequences with different sizes
> seem to be a rather common mistake (judging from the recurrence of the topic
> on that list).
> As Robert pointed, the current error message is not helpful.
> Could it be possible to change it ? A "(inconsistent sizes ?)" could at least
> be added...
People have looked at this before. IIRC, the conclusion was that at the specific
place where the exception needs to be raised, the information that it came from
a "ragged" input is lost, and that exception can be raised in other
circumstances as well (so it can't just be reworded). The number of cases that
array() tries to handle automatically is quite large, and that makes for hairy code.
OTOH, if you can pinpoint a place where we can raise a more specific exception
without changing the semantics of the function, I'd be happy to apply your patch.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion