Continuous extension of a partially defined function on a finite subspace

Let $$X$$ and $$Y$$ be topological spaces, and let $$x_1,...,x_m$$ be distinct points in $$X$$. Let $$f: \{x_1,...,x_m\} \to Y$$ be a function.

Is there a continuous extension of $$f$$ from $$\{x_1,...,x_m\}$$ to $$X$$?

It's easy to see that this is true if $$X = Y = \mathbb R$$, for example. But I'm not sure how far this generalizes. Does the result hold for arbitrary topological spaces, or do we need some assumptions about $$X$$ and $$Y$$?

It does not hold for arbitrary topological spaces if $$m>1$$: there are spaces $$X$$ with the property that every real-valued continuous function on $$X$$ is constant. Thus, if $$x$$ and $$y$$ are distinct points of such a space $$X$$, $$r$$ and $$s$$ are distinct real numbers, $$f'(x)=r$$, and $$f'(y)=s$$, there is no continuous function $$f:X\to\Bbb R$$ extending $$f'$$. It’s not hard to construct such counterexamples if we don’t impose any ‘niceness’ conditions on $$X$$ — just give $$X$$ the indiscrete topology, for instance — but in this answer I describe a construction, due to Eric van Douwen, of such spaces starting with any $$T_3$$-space containing two points that cannot be separated by a continuous real-valued function; in this answer I describe such a $$T_3$$-space, due to John Thomas.
If $$X$$ is a $$T_4$$-space, the Tietze extension theorem ensures that every real-valued function on a finite subset of $$X$$ has a continuous extension to $$X$$.
• The Tietze extension theorem also needs $Y = \mathbb R$, right? – user435571 Jul 11 at 2:36
• @user435571: Yes: that’s why I said real-valued. The last link in my answer gives more information about what can happen when $Y\ne\Bbb R$. – Brian M. Scott Jul 11 at 2:38
This is false. Let $$X$$ and $$Y$$ have at least $$2$$ points. Take $$X$$ to have the indiscrete topology and suppose that $$y \in Y$$. Take some $$f$$ with $$y \in im(f)$$ and $$|im(f)| \geq 2$$. Then let $$U = Y - \{y\}$$. If there was a continuous extension $$F$$, $$F^{-1}[U]$$ must then by nonempty and open, hence it must be all of $$X$$. Thus, all of $$F$$ must map into $$U$$, but we assumed that $$y \in im(f)$$, a contradiction.