The Walnut Tree is one of Aesop's fables and numbered 250 in the Perry Index. It later served as a base for a misogynistic proverb, which encourages the violence against walnut trees, asses and women.

A fable of ingratitude
 
There are two related Greek versions of the fable. Illustrating the ingratitude of those who requite good deeds with cruelty, it concerns a walnut tree (καρυα) standing by the roadside whose nuts the passersby used to knock off by throwing sticks and stones. It then complained, 'People gladly enjoy my fruits, but they have a terrible way of showing their gratitude.' Its complaint is related to a debate on gratitude that occurs in a parallel Indian story from the Panchatantra. There a mango tree is asked whether it is lawful to return evil for good and replies that its experience of man is violent treatment despite providing him with fruit and shade. On the other hand, the 18th century German rationalist, Gotthold Ephraim Lessing, questioned whether there are real grounds for gratitude in his fable of "The Oak Tree and the Swine". The pig feeding at the foot of an oak is reproached for its motives of pure greed by the tree and replies that it would only feel grateful if it could be sure that the oak had scattered the acorns there out of love for it.

The Greek fable was later the subject of an epigram by Antipater of Thessalonica:
They planted me, a walnut-tree, by the road-side
to amuse passing boys, as a mark for their well-aimed stones.
All my twigs and flourishing shoots are broken,
hit as I am by showers of pebbles.
It is no advantage for trees to be fruitful; I, indeed,
bore fruit only for my own undoing.
This in turn gave rise to Latin versions, in one of which the tree is represented as being pelted with rods. There was also a much longer poem, at one time ascribed to Ovid but now thought to be an imitation, in which the nut tree complains at length of the violent way in which it is despoiled. In this more leisurely work of 182 lines, as well as Aesop's fable of the nut tree being the subject, there is a glance at another concerning The Travellers and the Plane Tree. While the fruit tree is treated with no respect, 'barren plane trees have more honour for the shade they provide' (at postquam platanis sterilem praebentibus umbram uberior quavis arbore venit honor).

In Renaissance times the fable was taken up by the compilers of emblem books, starting with the originator of this genre, Andrea Alciato. Eventually numbered 193 in the many editions of his Emblemata, it bore the device In fertilitatem sibi ipsi damnosam (fruitful to its own ruin), deriving from the last line of the original epigram by Antipater. Many of the illustrations accompanying this feature boys stoning the tree and gathering its fruit from the ground. In others, however, youths are shown with substantial sticks in their hands, as in the illustration here, and so suggest the folk belief that beating it made the tree more fruitful. A German 'figure poem'  (figurengedichte) of 1650, in which the words are so spaced as to form a tree shape, mentions both sticks and stones as the weapons used by 'peasant girls and boys' to bring down the nuts. Inspired by Alciato's emblem, the poem is presented as the nut tree's soliloquy and goes on to make the wider point that the ingratitude of returning evil for generosity is a malaise that infects all social relations.

The proverb of a woman, an ass and a walnut tree
A few decades before Alciato first published his emblem, Aesop's fable had served as basis for an independent version by Laurentius Abstemius in his Hecatomythium, published in the 1490s. Numbered 65, De nuce, asino et muliere describes how a woman asked the abused tree 'why it was so foolish as to give more and better nuts when struck by more and stronger blows? The tree replied: Have you forgotten about the proverb that goes: Nut tree, donkey and woman are bound by a similar law; these three things do nothing right if you stop beating them.' The moral that Abstemius draws from it is that people talk too much for their own good. However, this proverb is cited as an example of misogyny.

The Italian proverb based on this lore was perpetuated in Britain for the next two centuries. George Pettie's translation of the Civil Conversations of Stefano Guazzo (1530–93), a book first published in Italy in 1574, records that he had once come across the proverb 'A woman, an ass and a walnut tree, Bring more fruit, the more beaten they be'. What is now the better known English version appears shortly after in the works of John Taylor, 
A woman, a spaniel and a walnut tree,
The more they're beaten the better still they be.

Roger L'Estrange includes Abstemius' story in his Fables of Aesop and Other Eminent Mythologists a century later. His shortened version runs: 'A Good Woman happen'd to pass by, as a Company of Young Fellows were Cudgelling a Wallnut-Tree, and ask'd them what they did that for? This is only by the Way of Discipline, says one of the Lads, for 'tis natural for Asses, Women, and Wallnut-Trees to Mend upon Beating.' L'Estrange's idiomatic comment, 'Spur a Jade a Question, and he'll Kick ye an Answer,' indicates his opinion of the sentiment. People's conversation will betray their true quality. Edmund Arwaker, on the other hand, gives the story another twist in his versified telling of the fables, Truth in Fiction (London, 1708). The talkative woman questions the tree in the course of a solitary walk and it replies in this way in order to silence her. 

Whatever may have been people's opinion of how well a woman, ass or dog respond to punishment, the belief that this was beneficial in the case of walnut trees persisted. One encyclopaedia of superstitions reports that in country districts 'it was a common persuasion that whipping a walnut tree tended to increase the produce and improve the quality of the fruit’ and that this took place in early spring. Another explanation is that 'the old custom of beating a walnut-tree was carried out firstly to fetch down the fruit and secondly to break the long shoots and so encourage the production of short fruiting spurs.’

References

Walnut Tree
Fables by Laurentius Abstemius
Misogyny
Greek Anthology
Emblem books
Walnut Tree