# Example of a non compact metric space

Give an example of a noncompact metric space on which every real valued continuous function is uniformly continuous.

My attempt: Consider $$\mathbb Q$$ with usual metric. As $$\mathbb Q$$ is not complete it is not compact. And the only continuous function from $$\mathbb Q$$ to $$\mathbb R$$ are constant functions so they all are uniformly continuous. Is this correct?

• From $\Bbb R$ to $\Bbb Q$ there are only constant functions. not the other way round.. – Henno Brandsma Aug 8 '20 at 19:38

Your example is not correct. Any continuous function on the real line restricted to $$\mathbb Q$$ is continuous.
Instead of this take $$X=\mathbb N$$ with the usual metric. Every function on this is uniformly continuous.