From: Travis O. <oli...@ee...> - 2006-10-11 16:46:32
|
Keith Goodman wrote: >On 10/11/06, Keith Goodman <kwg...@gm...> wrote: > > >>This works: >> >> >> >>>>M.asmatrix(['a', 'b', None]) >>>> >>>> >>matrix([[a, b, None]], dtype=object) >> >>But this doesn't: >> >> >> >>>>M.asmatrix(['a', 'b', None, 'c']) >>>> >>>> >>TypeError: expected a readable buffer object >> >> >> >>>>M.__version__ >>>> >>>> >>'1.0rc1' >> >>It also doesn't work for asarray and for tuples. >> >> >> > > > It is pretty fragile to rely on NumPy's "detection" of object arrays. The problem is that with the introduction of string, unicode, and record array styles, what is supposed to be an object array is harder to detect. The type-error propagates up from trying to create a record-array (apparently that's what was detected). You can only create record-array items from tuples or objects exposing the buffer interface. It's interesting that the detection algorithm gets thrown off by the addition of an other element. There may be an easy fix there. -Travis |