Let $X$ be an infinite set and let $(X,\tau)$ be a topological space such that for every non-empty $A\subseteq X$ there is a continuous map $r:X\to A$ such that $r(a) = a$ for all $a\in A$. Does this imply that $\tau$ is either discrete ($\tau = \mathcal{P}(X)$) or indiscrete ($\tau = \{\emptyset, X\}$)?



Infinite topological spaces such that every subset is a retract
Let $X=\mathbb N$ with the Alexandrov topology corresponding to the usual order. Then if $A\subseteq X$ is nonempty,


$$r(x)=\begin{cases}\min(A)&x<A\\
\max(A\cap\{0,\dots,x\})&\text{otherwise}\end{cases}$$


defines a retraction of $X$ to $A$ (continuity follows from the fact that it is nondecreasing).


