Suppose we have a set of regular functions defined on a product of metric spaces, for instance the Banach space of the smooth functions from $\mathbb R^n$ to $\mathbb C$. We know, thanks to the Taylor series, that such a function can 'almost' be written as a linear combination of products $f_1 \cdot \ldots \cdot f_n$, each of the $f_i$ a continuous function from $\mathbb R$ to $\mathbb C$, where the almost means we are using a density argument in the sup norm.

Is there a way to generalize such a situation to a generic product of metric spaces? In particular I am interested in the space of locally constant, compactly supported functions on powers of the $p$-adic field $\mathbb Q_p$ but also the general question sounds interesting. Any reference is greatly appreciated, thanks.