Verification of Alternate Proof for Identity Theorem in Conplex Analysis. Can't we prove Identity Theorem like this.

IDENTITY THEOREM.
  Consider a function which is analytic on an open connected domain $D$, if the set of zeros of $f$ has a limit point in $D$ then $f=0$ on $D$.

My Proof Idea.
If it is not $0$ identically then since the zeros of $f$ has a limit point in $D$ say $z_0$.
By continuity of $f$ we have  $f(z_0)=0$ and since $z_0$ is a limit point of set of zeros it is not isolated.
Thus $z_0$ being a zero of the non-constant analytic function $f$ is not isolated.
This contradicts the fact that  An non-constant analytic function has isolated zeros.
Hence our assumption is wrong and f is a constant function with value being zero.
 A: As far as I can tell, the error in your proof is in the last line, when you use the fact that a non-constant function has isolated zeros. This is definitely true if your domain is $\mathbb{C}, $ which is probably the version you are thinking of, but is false in general. For example, let $A$ and $B$ be disjoint and define a function $f$ by $f \equiv 0$ on $A$ and $f \equiv 1$ on $B.$ Then $f$ is analytic on $A \cup B$ and has non-isolated zeros but is not constant.
The theorem you are looking for is this: 
given a function $f\colon A \to B$, if $f$ has an accumulation point of zeros on some domain (i.e. open and connected) $C \subseteq A$ then $f$ is constant on $C$.
This phenomenon is more general throughout math, and is related to topology. For example, via purely topological methods we can show that if a function is locally constant on a connected component then it is globally constant on the whole connected component, but we cannot conclude the function is constant elsewhere.
Note: you should also use the assumption that $D$ is open, since if our limit point is on the boundary the Identity Theorem can fail. Note this is part of the theorem you should be using above.
