jaberg/Theano — comment on commit 2290d24ef5bba180108696be7d83c7db92c534a1
File:  line 0
By delallea:

I agree dtypes shouldn't be compared with 'is'.
However I think in this case, comparison should be made by comparing their ".num". The reason is that two dtypes can be == (i.e. represent the same kind of data) but have different .num. And some Theano C code fails if you use the wrong .num. This is the reason why theano._asarray exists: it ensures the .num is the one from the desired dtype (while numpy.asarray doesn't, keeping the current dtype if it is == to the desired one).