Continuous functions define a topology? The WP article on general topology has a section titled "Defining topologies via continuous functions," which says,

given a set S, specifying the set of continuous functions $S \rightarrow X$ into all topological spaces X defines a topology [on S].

The first thing that bothered me about this was that clearly this collection of continuous functions is a proper class, not a set. Is there a way of patching up this statement so that it literally makes sense, and if so, how would one go about proving it?
The same section of the article has this:

for a function f from a set S to a topological space, the initial topology on S has as open subsets A of S those subsets for which f(A) is open in X.

This confuses me, because it seems that this does not necessarily define a topology. For example, let S be a set with two elements, and let f be a function that takes these elements to two different points on the real line. Then f(S) is not open, which means that S is not an open set in S, but that violates one of the axioms of a topological space. Am I just being stupid because I haven't had enough coffee this morning?
 A: The first statement can be patched up using functions into the Sierpinski Space $\{0,1\}$ with topology $\{\varnothing , \{1\}, \{0,1\}\}$. Since a continuous function $X \to \{0,1\}$ can be identified with the open set $f^{-1}(1)$ we see the continuous functions into the Sierpinski space are the same thing as the open subsets of $X$.
A: Your first question is easily addressed. Yes, on the face of it, there are a proper class of such maps. However, we can restrict attention to topological spaces $X$ which have cardinality no greater than $S$, since we can leave off the part of a space not in the image of $f$. Up to homeomorphism, there are only set-many such $X$ (specifically, $2^{2^{\vert S\vert}}$-many at most). And for each specific space $X$, there are only set-many maps from $S$ to $X$.
Incidentally, there is still one remaining subtlety: actually picking out a set of "enough target spaces". This is potentially an issue, since each homeomorphism type contains a proper class of spaces! This can be handled - without even using choice! - by noting that every such homeomorphism type has a representative of rank (in the cumulative hierarchy sense) $\le\kappa+3$, where $\vert X\vert+\aleph_0\le \kappa$ (this is actually massive overkill but oh well); and the class of all topological spaces of a bounded rank is a set.
EDIT: Daron's answer gives a much slicker way to approach the problem. However, it's worth understanding the brute-force approach above, since that kind of reasoning is useful in other contexts as well where we have to deal with an apparent proper class of objects.
Re: your second question, yep, that's a pretty fundamental mistake. It should go the other way: you take the preimage of open sets in the target space. Specifically, the topology induced by $f$ is $$\{A\subseteq S: A=f^{-1}(U)\mbox{ for some $U$ open in the target space}\}.$$ The discrepancy, of course, is due to the fact that $f\circ f^{-1}(U)\subseteq U$, but these sets are not equal in general.
