Suppose I have a commutative ring with unity $A$, $f \in A$ and a prine ideal ${\mathcal{P}}$. I have learned that $A_f$ can be naturally thought of as an open subset of Spec $A$. I was wondering if something similar holds for the localized (at ${\mathcal{P}}$) ring $A_{\mathcal{P}}$? (i.e. can we naturally view $A_{\mathcal{P}}$ as an open subset of Spec $A$?)
Thanks!
$A_f$ is the ring of global sections of the standard-open subset $D(f)$ with respect to the usual sheaf $\mathcal{O}_{\mathrm{Spec}(A)}$ on $\mathrm{Spec}(A)$. You have to distinguish between $A_f$ and $D(f)$. The connection is given by $D(f) \cong \mathrm{Spec}(A_f)$ and $A_f \cong \Gamma(D(f),\mathcal{O}_{\mathrm{Spec}(A)})$.
$A_\mathfrak{p}$ is the stalk of the sheaf $\mathcal{O}_{\mathrm{Spec}(A)}$ at $\mathfrak{p}$. Thus, this ring captures the local information at $\mathfrak{p}$.
(This is explained in detail in every introduction to affine schemes, for example the book by Görtz-Wedhorn or by Bosch.)