Dummit and Foote: "extensions" of a function Dummit and Foote define an extension of a function as follows.

If $A \subseteq B$ and $g: A \to C$ and there is a function $f: B \to C$ such that $f \mid _A =  g$, we shall say that $f$ is an extension  of $g$ to $B$ (such a map $f$ need not exist nor be unique.)

I do not understand, in particular, the notion that $f$ may not exist. I tried to consider an edge case where $ g(a) = \frac{1}{a}$, which is clearly $g$ is undefined at $0$, so we may have $0 \in B \setminus A$. However, I can define $f$ in a piecewise manner, say, $f(b) = \frac{1}{b}$ if $b \in A$ and $f(b) = 5$ if $b \in B \setminus A$. This function is well-defined and, when restricted to $A$, is the same function as $g$.
Is there a way where this $f$ cannot exist?
 A: As a function of sets, the only situation in which $f$ does not exist is when $A=C=\emptyset\neq B$, but this uses the fact the empty function $g=\emptyset$ is the only function allowed to have an empty codomain, so it is arguably the edgiest of edge cases.
Most of the time, however, we are not interested merely in functions, but rather maps in a particular category.  For instance:

*

*Continuous functions between topological spaces

*Ring homomorphisms between rings

*Group homomorphisms between groups

In this case, $g$ might be a nontrivial function of a given type, but no $f$ of the same type exists extending $g$ to $B \supset A$.
Considering your example in this light, $g : \mathbb{R}\setminus\{0\} \to \mathbb{R}$ is a continuous function between the two spaces, but there is no continuous function $f : \mathbb{R} \to \mathbb{R}$ extending $g$.
A: I am surprised that the proper subset symbol is not used. This definition seems to allow $A=B$ and thus $g$ is an extension of $g$ itself, in which case an extension must exist if $g$ exists.
