It is reported that Wahb b. Munabbih – Allāh have mercy on him – used to say:

The believer mixes with others in order to learn, keeps quiet to keep safe (from sinning), speaks in order to understand, and secludes himself for the attainment (of good).

Ibn Abī Al-Dunyā, Al-‘Uzlah article 99.