For a given language A let A(n) denote the number of words in A of length smaller or equal to n. It is know that if A is a regular language then the function $ f(x) = \sum_{i=0}^\infty A(n)x^n$ is in fact a rational function.
Obviously there exist languages which are not regular but which have this property.
My question: does this property characterizes regular languages in any other, bigger, class of languages (computable in linear time, context-free,...)?