TITLE: What determines if a function has a least positive period?
QUESTION [11 upvotes]: This question stems from this one, where if $f$ is continuous and $f(x) = f(x+1) = f(x+\pi)$, then $f$ must be constant. The above is shown using the density of $\mathbb{Z}+\pi\mathbb{Z}$ in $\mathbb{R}$ and the continuity of $f$. However, what jumps out at me from the question is the (seeming) incongruity of a period that is both rational and irrational.
Specifically, if $f$ is non-constant and has a least positive period, $T$, then it cannot be that $f(x)=f(x+1)=f(x+\pi)$, since that would imply that $\pi$ is rational. But, as was pointed out to me, this cannot be used to prove the above because not every periodic function has a least positive period.
So my question is, what determines if a function has a least positive period? Are there certain classes of functions that, if periodic, must have a least positive period? For instance, continuous periodic functions?
Also, what other examples are there of non-constant periodic functions that do not have a least positive period? The example given to me (and the only one given on the Wikipedia page) is the indicator function of rational numbers.

REPLY [5 votes]: The other answers are very good.  Here is a 1915 theorem of Burstin that also seems relevant:

If a Lebesgue measurable function $f: \mathbb{R} \rightarrow \mathbb{R}$ has arbitrarily small periods, then $f$ is constant almost everywhere.  

A nice proof is given in this one page MONTHLY note of J.M. Henle.  A comment at the bottom claims that Burstin's original proof was faulty.