A matter of choice of stating the domain of the function in analysis/topology textbooks - narrower or broader at first? It is customary to see in mathematical analysis that the domain of the function in definition or theorem would require as "small" as possible. For example, recall that the Extreme Value Theorem often phrased like this: 

Way 1: Let $f:[a,b]\to\Bbb R$. If $f$ is continuous, then $f$ has a max/min on $[a,b]$.

In contrast, authors usually don't like to state as:

Way 2: Let $E\subseteq \Bbb R$, $f:E\to\Bbb R$ and $[a,b]\subseteq E$, if $f$
  is continuous on $[a,b]$, then $f$ has a max/min on $[a,b]$

(Notice that in this case, the domain $E$ of the function in the context can be a "fragile" set, such like $(1,5)\cup (10,15)\cup (20,24)$.)
Now, if we have a function $f:(1,5)\cup (10,15)\cup (20,24)\to \Bbb R$ at hand, then does it have a max/min on $[2,4]$? Yes, but given different description of theorem, we have different argument. If we adopt the first one, we would say: because $f\vert_{[2,4]}$ is a function that defined on a closed bounded set $[a,b]$, so by the theorem, $f\vert_{[2,4]}$ has a max/min on $[2,4]$. However, if we adopt the second one, we would say: since $[2,4]\subseteq\text{dom} (f)$, by the theorem, $f$ has a max/min on $[2,4]$ (we don't need to make the restriction here, since this precisely suite the theorem itself this time).
One more example, in defining Riemann integrability, people always stated the hyphothesis as

Let $f:[a,b]\to\Bbb R$, $f$ is called integrable if ...

rather than

Let $E\subseteq\Bbb R$, $f:E\to\Bbb R$, and $[a,b]\subseteq E$, $f$ is called integrable on $[a,b]$ if ...

Next, below is the definition of analyticity of a point of a function from Terrence Tao's Analysis II.

Definition: Let $I$ be an open interval, $c\in I$ and $f:I\to\Bbb R$. We say that $f$ is analytic at $c$ if there exists $\delta>0$
  such that $(c-\delta,c+\delta)\subseteq I$ and there exists a power
  series $\sum a_n(x-c)^n$ with radius of convergence $R\geq \delta$,
  such that $f(x)=\sum a_n(x-c)^n$ for all $x\in(c-\delta,c+\delta)$.

If we have a function $f:[0,1)\cup [10,20)\cup [40,50]\to \Bbb R$, which defines by $f(x)=\sin x$. Notice that this definition from Tao is similar to the type 1 way, which means he requires the domain of the fuction in interest as minimal as possible. (Though this time it is a definition, rather than EVT, which is a theorem. However, doesn't matter for our discussion here.) 
We all know that $f$ is definitely "very good" to be "analytic" at every point(interior point). However, rigorous speaking, it seems that we cannot simply say that $f$ is analytic at, say, the point $0.5$, since this does not suit the exact pattern that the definition just said! If we truly want to say something about the analyticity of $f$ at $0.5$, we must make a restriction by ourselves first, then say something like $f\vert_{(0.3,0.6)}$ is analytic at $0.5$, which is very burdensome. And that's why I post this.


*

*Is their any better way to say about this?

*Or should we always adopt the second way to phrase the definitions and theorems?

*Any suggestions?

 A: In the end, this all can be attributed to habits and indifference with the authors. Many books have a sense of "good enough" that is usually not really holding up to really rigorous inspection. Like Petr's answer mentions, this is actually precisely the reason that formalisation of mathematics is a nontrivial task.
Therefore we have to be concerned with a notion of "good enough". So on the one hand we have the statement:

But it's blatantly obvious that this definition extends to arbitrary functions, because the assumption that $I$ is an interval is not critical in the definition.

while on the other we find those more formally inclined, like you, who are concerned about the actual validity of the definition/theorem statement.

Now there is a case to be made for either approach, and the balance is up to every author.
Personally I'm more a fan of formally correct definitions (note how in Tao's definition, an arbitrary $S \subseteq \Bbb R$ would also have worked in place of $I$). However, the reader should not be confronted with excessive generality which obstructs understanding (think "differential").
In most cases it is sufficient if the more technically correct definition(/theorem/proof(!)) is simply accompanied by some prose where the exact intuition and special cases are elaborated. Consider the clarity added by just stating that one will now define "the local concept of analyticity". Sadly, many a book's prose is not doing this to a satisfactory extent.
What is a bad idea in all cases is to mix the two styles. Either be formal or loose, but don't define loosely and then start using restrictions, inclusions and other formal machinery in your proofs. In particular it is probably a good idea for students to find a book that suits their natural level of formality -- it makes everything much easier.
A: When you present a piece of mathematics to someone else the main goal is for them to understand the ideas in it. Making it technically correct is the last concern (of course, making sure the reasoning is correct is very important!). Taking your example: it's impossible for someone to genuinely don't think that $\sin(x)$ isn't analytic while understanding the idea behind analyticity (i. e. function is smooth near the point). Purely logical way of thinking is the computer way. Fortunately or unfortunately, we are humans so we do mathematics the human way.
In your example it is easy to "make $\sin(x)$ analytic": just change "open interval" in the definition to "open set". However, in general the most technically correct way is not the most comprehensible and thus should be avoided. 
There are other things you sometimes have to sacrifice for the sake of clearness. In fact, you can find something on this matter in the Terrence Tao's blog, for example here.
A: Yes, this is a major problem. It makes the material harder to teach, harder to understand, and if we're serious about computer-formalization of math, it's going to bite us repeatedly until we figure it out. Furthermore, I think one of the problems is the irrational and fairly widespread distaste for partial functions. Until people are willing to take partial functions $f : \mathbb{R} \rightarrow \mathbb{R}$ seriously, this will remain a problem.
In any event, here's a rough sketch of how to fix these kinds of problems.
For a partial function $f : \mathbb{R} \rightarrow \mathbb{R}$, then we can distinguish two different notions of continuity as follows:


*

*$f$ is openly continuous iff preimages of open sets are open. Note that this implies $f^{-1}(\mathbb{R})$ is open, so for example the square root partial function $\mathbb{R} \rightarrow \mathbb{R}$ fails to be openly continuous, since it's preimage is $[0,\infty)$.

*$f$ is limit continuous iff it interacts nicely with limits. In particular, $f$ is weakly continuous iff for all $x \in f^{-1}(\mathbb{R})$ and all sequence $s$ in $f^{-1}(\mathbb{R})$, we have that if $s$ converges to $x$, then $f(s)$ converges to $f(x)$. For example, the square root partial function is limit continuous.
With that distinction in mind, we can define open and limit analyticity as follows:


*

*$f$ is openly analytic iff $f^{-1}(\mathbb{R})$ is open, and at each $x \in f^{-1}(\mathbb{R})$ the function $f$ looks like a power series.

*$f$ is limit analytic iff


*

*$f$ is limit continuous

*the restriction of $f$ to the interior of $f^{-1}(\mathbb{R})$ is openly analytic



Something like that.
Now, I'm not 100% sure these definitions are the correct notions, or that they do what we want them to do, but you get the general gist; if we move to partial functions, we can start to think about how to fix this remarkably ubiquitous problem.
