We say that a $T\_2$-space has the *open extension property (OEP)* if for any open set $U$ and continuous map $f:U\to U$ there is a continous map $g:X\to X$ such that $g|\_U = f$.


The space $\mathbb{R}$ with the Euclidean topology does not have this property: consider $(0,1)\cup(1,2)$ and the map $f$ sending $(0,1)$ to $\frac{1}{2}$ and $(1,2)$ to $\frac{3}{2}$.


We say that a space $(X,\tau)$ is *totally disconnected* if for $x\neq y\in X$ there is a clopen (closed and open) set $U$ such that $x\in U$ and $y\notin U$.


**Question.** Does (OEP) imply total disconnectedness?



Extending a continuous self-map of an open subset to the whole space
Take any pair of distinct points $x, y$. Define a partial order on the set of pairs of disjoint open sets $U \ni x, V \ni y$ by double inclusion (i.e. $(U\_1, V\_1) \preceq (U\_2, V\_2)$ if $U\_1 \subseteq U\_2, V\_1 \subseteq V\_2$). The set of pairs is nonempty, as $X$ is $T\_2$. Then by Zorn's lemma, there is a maximal such pair $(U, V)$. I claim that if $X$ has the OEP, then $X = U \cup V$, and therefore $U$ is clopen.


Assume otherwise, and that there is some $z \notin U \cup V$. Then $z \in \bar{U}$, as otherwise, there would be some open set $W \ni z$ not meeting $U$, and $(U, V \cup W)$ would be a larger pair than $(U, V)$. Similarly, $z \in \bar{V}$. 


Edit: Zorn's lemma is unnecessary. Let $U\_1 \ni x, V\_1 \ni y$ be disjoint open sets (as guaranteed by $T\_2$). Then let $U = \overline{\text{int}(\overline{U}^c)}^c$, and let $V = \text{int}(\overline{U}^c)$. Note that $U = \text{int}(V^c)$ and that $V = \text{int}(U^c)$. 


Define $f: U \cup V \rightarrow U \cup V$ by $f(U) = x, f(V) = y$. This is clearly continuous (as the preimages are $\emptyset, U, V,$ and $U \cup V$), so by the OEP, there must be some $g: X \rightarrow X$ extending $f$. But then because $X$ is $T\_2$, we have that $f(z) = x, f(z) = y$ - a contradiction. Therefore, there can be no such $z$, so $X = U \cup V$. Therefore, $U = V^c$ is clopen, and $x \in U \not\ni y$, so we are done.


There's not much that requires the "target space" of the maps to be $X$; this proof works for any $T\_2$ space. It also doesn't require $f$ to have outputs in $U$ specifically; having more than one point (and so can distinguish between $U$ and $V$) is enough.


