[Numpy-discussion] dtype.isbuiltin changed by .newbyteorder

Matthew Brett matthew.brett@gmail....
Thu Jan 14 11:02:43 CST 2010


Hi,

> It is at least undesirable. It may not be a bug per se as I don't
> think that we guarantee that .isbuiltin is free from false negatives
> (though we do guarantee that it is free from false positives). The
> reason is that we would have to search the builtin dtypes for a match
> every time we create a new dtype object, and that could be more
> expensive than we care to do for *every* creation of a dtype object.
> It is possible that we can have a cheaper heuristic (native byte order
> and the standard typecodes) and that transformations like
> .newbyteorder() can have just a teeny bit more intelligent logic about
> how it transforms the .isbuiltin flag.

Thanks - that's very clear and helpful, and made me realize I didn't
understand the builtin attribute.

I suppose something like the following:

output_dtype.isbuiltin = input_dtype.isbuiltin and new_byteorder == native

would at least reduce the false negatives at little cost.

Cheers,

Matthew


More information about the NumPy-Discussion mailing list