TITLE: Generalisations of properties of limits to metric spaces
QUESTION [0 upvotes]: I know the calculus lemma stating that 

If $\lim_{x\to x_0}f(x)=z_0$ and $g$ is continuous in $z_0\in\mathbb{R}$, then $\lim_{x\to x_0}g(f(x))=\lim_{z\to z_0}g(z)=g(z_0)$.

It seems to me quite straightforward that the lemma also holds for $f:X\to Z$ and $g:Z\to Y$ where $X,Y,Z$ are generic metric spaces with $x_0\in D(X)$ -where $D(X)$ is the set of the limit points of the domain $X$ of $f$- and $z_0\in Z$ (and also with $x_0=\pm\infty$, if $X\subset\mathbb{R}$, or $x_0=\infty$, if $X\subset\mathbb{C}$ or $X\subset\mathbb{R}^n$ where $n\geq 2$).
Analogously, I know the lemma stating that

If

$\lim_{x\to x_0}f(x)=z_0\in\mathbb{R}\cup\{\pm\infty\}$, $\lim_{z\to z_0}g(z)=y_0\in\mathbb{R}\cup\{\pm\infty\}$;
$f(x)\ne z_0$ in $(a,x_0)$ e $(x_0,b)$, or for $x\lessgtr M$ for some $M$ in the case where $x_0=\pm\infty$;
$g(f(x))$ is defined in a "neighbourhood" [to use my book's words] $(a,x_0)$ and $(x_0,b)$, or for $x\lessgtr M$ for some $M$ in the case where $x_0=\pm\infty$;

then $\lim_{x\to x_0}g(f(x))=\lim_{z\to z_0}g(z)=y_0$

and I think that it is almost trivially valid, if we replace "$(a,x_0)$ and $(x_0,b)$" with  "$U\setminus\{x_0\}$ where $U$ is a neighbourhood of $x_0$", for any metric spaces $X,Y,Z$ with $f:X\to Z$, $g:Z\to Y$, $x_0\in D(X)$ and $z_0\in D(Z)$ (but also with $x_0$ or $y_0$ or $z_0$ infinite if $X$ or $Y$ or $Z$ are subsets of $\mathbb{R}^n$ or $\mathbb{C}$).
Are my generalisations correct? I heartily thank you for any answer!

REPLY [1 votes]: personally i take as my definition of continuity that you can take the function through limits -- this is equivalent to the standard one. (see my book Proof Patterns)
To more precisely answer your question, if we define a bijection from ${\Bbb R}$ to $(-1,1)$ then we can define convergence to $\infty$ as convergence of the mapped sequence to $1.$ The results you want then just translate appropriately. 
A suitable map would be 
$$
x \to \frac{2}{\pi} \tan^{-1}(x)
$$
{"set_name": "stack_exchange", "score": 0, "question_id": 1164615}