According to this answer, \colon is of type \mathpunct. But in the MWE below, the outputs of the two lines are not identical. Why not?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
& g\colon X\to Y\\
& g\mathpunct{:} X\to Y
\end{align*}
\end{document}

amsmathredefines the\colonmacro. – egreg Apr 17 '15 at 20:26