why not ``dtype = X.dtype``? (also, maybe add the reason as a comment as it is not very obvious ;)