Path-Connected Space is Connected/Proof 2

Proof
Let $D$ be the discrete space $\set {0, 1}$.

Let $T$ be path-connected.

Let $f: T \to D$ be a continuous surjection.

Let $x, y \in T: \map f x = 0, \map f y = 1$.

Let $I \subset \R$ be the closed real interval $\closedint 0 1$.

Let $g: I \to T$ be a path from $x$ to $y$.

Then by Composite of Continuous Mappings is Continuous it follows that $f \circ g: I \to D$ is a continuous surjection.

This contradicts the connectedness of $I$ as proved in Subset of Real Numbers is Interval iff Connected.

Hence the result.