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

Matthew Brett matthew.brett at gmail.com
Thu Jan 14 12:02:43 EST 2010


> 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.



More information about the NumPy-Discussion mailing list