Today I am reading Hartshorne Algebraic geometry section 1.3
For $P\in Y, $ we define the local ring of $P$ on $Y, O_P, $ to be the ring of germs of regular functions on $Y$ near $P$. Its maximal ideal $m$ is the set of germs of regular functions which vanish at $P. $ For if $f(P) \neq 0,$ then $1/f$ is regular in some neighborhood of $P$.
I have questions about the last sentence.
My understanding is: it is (generally) not true that
For any topological spaces $X,Y$, continuous $f:X\rightarrow Y$, any element $0\in Y$, $f(P)\neq 0\implies f(U)\neq 0$ for some neighborhood $U$ of $P$. (*)
Here is my reasoning for (*):
Consider the contrapositive, the statement becomes: if $x_{i}\rightarrow P$, $f(x_{i})=0$, then $f(P)=0.$ For all topological spaces continuity implies sequential continuity, so we only need to show the sequence $0,0,\cdots $ converges uniquely to $0.$ This is only true when the topology of $Y$ is $T_1.$ Zariski topology (on algebraic varieties) is $T_{1}$ so the Hartshorne statament is true.
My question is: is my reasoning correct? If it is, is there any better way to understand (internalize) this statement, i.e., "For if $f(P) \neq 0,$ then $1/f$ is regular in some neighborhood of $P$''? I feel like I took too many steps to understand it.