Continuity of a function and its restriction Let $(X,T)$ be a topological space and $A$ subset in $X$, and
$f:X\to (Y,t)$ a function. 
If $A$ is open and $g:A\to Y$ is continuous (where $g$ is the restriction of $f$ on $A$) , then so is $f$.
Can someone prove it for me?
 A: So the data is: $(X, \mathcal{T})$ is a space, $f: (X,\mathcal{T}) \to (Y,\mathcal{T}')$ is a function to another space, $A\subseteq X$. You assume further that $A$ is open and $g=f \restriction A$ is continuous, and you want to show $f$ is continuous? This is clearly false: take as a trivial example $X=\{0,1\}$ with the Sierpinski topology, $Y=\{0,1\}$ in the discrete topology, $f=\text{id}$, which is not continuous even though $f\restriction A$ is continuous and open for $A=\{0\}$. 
So you probably mean something else?
A: Under the additional assumption, stated in the comments (by the OP and later deleted), that $X=\cup\{A_i:i\in I\}$ (for some index set $I$) where each $A_i$ is open and each restriction $f:A_i\to Y$ is continuous, then indeed $f:X\to Y$ is continuous$. 
Take any open $U\subset Y$ we need to show that $f^{-1}(U)$ is open in $X$. Each $A_i\cap U$ is open, and hence, by continuity of $f$, we have that $f^{-1}(A_i\cap U)$ is open. 
Finally $f^{-1}(U)=\cup\{f^{-1}(A_i\cap U):i\in I\}$ is open, as the union of open sets. 
Regarding the question as originally stated:
Let $X$ be a topological space and $A$ subset in $X$, and $f:X\to Y$ a function. If $A$ is open and $g:A\to Y$ is continuous (where $g$ is the restriction of $f$ on $A$), then so is $f$. Can someone prove it for me? 
The above statement cannot be proved as it is incorrect. If it were correct, then it would imply that all functions between all topological spaces are continuous. Indeed, let $A$ be the empty set $\emptyset$. Then the restriction $g:A\to Y$ is continuous. If the above statement were correct, Then $f$ would also be continuous. 
For a specific example, let $X=[0,1]$, $A=[0,1)$ and $Y=\Bbb R$ (or $Y=[0,1]$, or $Y=\{0,1\}$, either way). Let $f(x)=0$ for $x\in A$, and $f(1)=1$. Then $f$ is not continuous (since $\lim\limits_{x\to1^-}f(x)=0\neq1=f(1)$), even if the restriction of $f$ to $A$ is constant (and hence continuous). 
For an even better/intuitive understanding take the following point of view. 
Start with $X,Y,A$ and continuous $g:A\to Y$. Then extend $g$ on all of $X$, arbitrarily, to obtain some function $f:X\to Y$. There are (in general) zillions of ways to obtain such extensions, and very few of them (under some special/additional conditions) would be continuous. Most of the time such an extension would be discontinuous. (@HennoBrandsma was also alluding to this, in a comment to his answer, I would believe.)
