Thus, is a constant morphism if the function given by composition with is a constant function for every object .
Another definition that is sometimes used is the following.
A morphism in a category is constant if, for every object , exactly one morphism from to factors through . Assuming that has a terminal object, is constant iff it factors through this terminal object.
This second definition implies the first, but they are not equivalent in general. In the category of sets, the first implies the second if the set is inhabited. More generally, if is a morphism in a category , then the two definitions are equivalent if is inhabited for every . If has a terminal object , then this is equivalent to the existence of a global section .
See the forum for further discussion of this.
Using the two-point set, it is simple to show that the constant morphisms in Set are precisely the constant functions.