Yoda is not mourning the death of the Jedi after order 66. He is physically responding to the disturbance in the force caused by the death of so many powerful Jedi. The same way Obi Wan reacted in Episode 4 when Alderaan was destroyed.
Edited to add:
The part where Yoda is actually attacked was left out of the novelization but later, when Obi Wan freaks out about the children, this dialog occurs:
"We took them from their homes." Obi-Wan fought to stay in his chair; the pain inside him demanded motion. It became wave after wave of tremors. "We promised their families—"
"Control yourself, you must; still Jedi, you are!"
"Yes, Master Yoda." That scab on his knuckle—focused on that, he could suppress the shaking. "Yes, we are Jedi. But what if we're the last?"
"If the last we are, unchanged our duty is." Yoda settled his chin onto hands folded over the head of his gimer stick. He looked every day of his nearly nine hundred years. "While one Jedi lives, survive the Order does. Resist the darkness with every breath, we must."
He lifted his head and the stick angled to poke Obi-Wan in the shin. "Especially the darkness in ourselves, young one. Of the dark side, despair is."
The simple truth of this called to him. Even despair is attachment: it is a grip clenched upon pain. Slowly, very slowly, Obi-Wan Kenobi remembered what it was to be a Jedi.
So in this scene from the novelization Yoda is clearly saying not to grieve for the dead Jedi. It is not in the movie and I am not clear if novelization is considered canon or not, but well... it's here.