Definition of continuity implies a discontinuous function is continuous? So I have a text that defines a function $f$ to be continuous if $f^{-1}(A)$ is open whenever $A$ is open.  However, that seems like a confusing definition since it doesn't specify if the open sets are chosen from the range or from the codomain, but either choice seems to lead to something counter-intuitive.  For instance, if we say that the open sets are chosen from the co-domain then that seems to imply 
$$ f(x) = \begin{cases}0 & \text{if } x<2 \\1 & \text{if } x\geq 2\end{cases}$$
is open because there are no open sets in the codomain and therefore the "for all" sentence is vacuously true.
If, on the other hand, we choose the range as the set from which open sets are selected then it seems like 
$$ g(x) = \arctan(x)$$
isn't continuous because we could choose $A=(0,\infty)$ in which case $f^{-1}(A)$ isn't defined.  
Moreover, none of this seems to allow for a notion of continuty "at a point".  How could one use this definition to say that $f$ is continuous at $1$ but not $2$?  Would that be something like:  "For all open sets in the codomain/range, $A$ such that $x\in f^{-1}(A)$, it follows that $f^{-1}(A)$ is open."?
My guess is that $\arctan(x)$ is actually not continuous as $\arctan(x):\mathbb{R}\rightarrow \mathbb{R}$ but is continuous as $\mathbb{R}\rightarrow (-\pi/2,\pi/2)$ but I just want to confirm this hypothesis.
 A: If $f:X\to Y$ is a function, and $A\subseteq Y$ is any subset whatsoever, the notation $f^{-1}(A)$ means
$$f^{-1}(A)=\{x\in X:f(x)\in A\}$$
This set is defined regardless of whether $A$ is contained within $f(X)$, the range of $f$.
Therefore the fact that there are no open subsets of $\mathbb{R}$ contained in the set $\{0,1\}$ does not, by any means, imply that the condition "$A$ open $\implies$ $f^{-1}(A)$ open" is vacuous for the function you described:
$$f(x) = \begin{cases}0 & \text{if } x<2 \\1 & \text{if } x\geq 2\end{cases}$$
In fact, choosing the open subset $A=(\frac{1}{2},\frac{3}{2})$ of $\mathbb{R}$, we have that $f^{-1}(A)= [2,\infty)$ is not an open subset of $\mathbb{R}$, thereby demonstrating that this $f$ is not continuous.
A: The definition of continuous function in your text is more general and abstract than the usual definition of continuity at a point for real valued function.
It refers to two topological spaces that, in general, are not metric spaces.
The correct definition is:

Given two topological spaces $X$ and $Y$, a function $f:X\rightarrow
> Y$ is continuous if for every open set $A \subset Y$, we have that
$f^{-1}(A)=\{x \in X : f(x) \in A\}$ is an open subset of $X$.

Note that $A$ is a subset of the codomain $Y$. The term "range" is used sometime as synonymous of codomain and sometime as synonymous of image, i.e the set $\{y \in Y : y=f(x)\}$, so I prefer not to use it.
So your first function is obviously non continuous, since any open set of the form $A=(a,b)$ with $0<a<1$ and $1<b$ is such that $f^{-1}(A)=[2,\infty)$.
The function $\arctan (x)$ is continuous as a function $\mathbb{R}\rightarrow \mathbb{R}$, note that for any open set $A$ in $\mathbb{R}$ , $f^{-1}(A)$ may be the void set, but it's also open.
We can say that a function is continuous at a point iff for any neighborhood $U$ of the image of the point, $f^{-1}(U)$ is  a neighborhood of that point.
