[Numpy-discussion] comparison operators (e.g. ==) on array with dtype object do not work

Yaroslav Halchenko lists@onerussian....
Thu Jan 14 18:05:16 CST 2010


On Thu, 14 Jan 2010, josef.pktd@gmail.com wrote:
> It looks difficult to construct an object array with only 1 element,
> since a tuple is interpreted as different array elements.
yeap

> It looks like some convention is necessary for interpreting a tuple in
> the array construction, but it doesn't look like a problem with the
> comparison operator just a consequence.

Well -- there is a reason why we use tuples -- they are immutable ... as
well as strings actually ;)  Thus, imho, it would be a logical API if
immutable datatypes are not coerced magically into mutable arrays at
least whenever I am already requesting dtype='O'.  Such generic
treatment of immutable dtypes would address special treatment of
strings but it is too much of a change and debatable anyways ;-)

-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        


More information about the NumPy-Discussion mailing list