The maxim "Nil desperandum" (Odes, Book I, ode vii, line 27) seems to be in most cultures. "Never despair" is absolutely necessary to overcome problems we all encounter in life.
Horace (65-8 BCE) was a literary critic, a lyric poet, and a great satirist. He was the son of a freed slave and had the opportunity to study in Rome and at the Athens Academy. He met Cicero there.
Horace may have had many reasons to despair as all his family's belongings were confiscated. Moreover, most probably he must have had a very hard time after the murder of Julius Caesar, especially when he was exiled. However, his maxim probably helped him face the problems he had. "Nil desperandum" or "Never despair" appears in his famous Odes, where he also uses similar expressions such as "In adversity, remember to keep an even mind" (Book II, ode iii, line 1).
I think Horace's maxim is very much related to what other authors have written using other words. For example, last month I bought Rojas Marcos' newext book. I have always enjoyed listening to him, one of the most popular Spanish phychologists in the world. His book "All I have learnt, 303 ideas for a better life" (my own translation of the original title) is full of interesting albeit brief ideas. His book is filled with positive ideas that aim at helping the reader in his/her life. One of the general ideas that comes up very frequently is that of being optimistic.
I suppose that Horace's maxim and Professor Rojas Marcos' thought are very much interelated. If we have problems and give up, how are we going to overcome them?, what is the point in throwing the towel in case of trouble? "Only in the boxing ring", my friend says.