"Powers" of compact Hausdorff spaces Suppose $X$ is a compact Hausdorff space and $\mathbf 2$ is the space whose underlying set of points is $\{0,1\}$ equipped with the discrete topology. Clearly $\mathbf 2$ is compact Hausdorff. Denote by $C(X,\mathbf2)$ the space of all continuous functions from $X$ to $\mathbf2$, equipped with the compact-open topology. I know that $C(X,\mathbf2)$ is Hausdorff. My question is: is it compact or locally compact?
 A: Let $\langle X_\alpha\rangle_{\alpha<\kappa}$ be an enumeration of connected components in $X$. If $f\in C(X,2)$ then $f$ is a constant on each $X_\alpha$. So we can identify $C(X,2)$ as the set of all functions from $\kappa$ to $2$ endowed the topology generated by
$$V(A, n) = \{f : f[A] = n\}$$
for $A\subseteq \kappa$ and $n=0,1$.
For any function $f:\kappa\to 2$ consider $A_f = \{\alpha<\kappa : f(\alpha)=0\}$, then $$\{f\} = V(A_f,0)\cap V(\kappa - A_f, 1)$$ so our space is discrete, which is not compact unless $\kappa$ is finite.

I found that my previous answer is wrong. It implicitly assumes that each connected components are open, but it holds only when $X$ is locally connected, so if $X$ is locally connected (for example, disjoint union of $\kappa$ copies of closed interval $[0,1]$) then $C(X,2)$ is discrete space. In that case, $C(X,2)$ is locally compact.
However, although above proof is wrong, $C(X,2)$ is discrete in general. Its proof is given from slight modification to the 'wrong' proof. Let $f:X\to 2$ be a continuous function. Define $$A_f:= \{x\in X : f(x) = 0\} = f^{-1}[\{0\}]$$
It is an inverse image of a closed set, so is compact. Moreover, $A_f$ is an inverse image of a open set, so $A_f$ is also open (thus $X-A_f$ is compact.) Since
$$\{f\} = V(A_f,0)\cap V(X - A_f, 1)$$
holds, $\{f\}$ is open in $C(X,2)$, i.e. $C(X,2)$ is discrete. Thus $C(X,2)$ is locally compact, of course.
