I managed to be class clown in most of my classes. I'd ask some of the most absurd questions, or throw in side comments in the sort of class that welcomed that. Some classes it was clear: you don't upstage the teacher. Ever. But a good straight line lets the teacher be the one who actually cracks the joke, while leaving the impression that the class clown is still humorous.
It seems to me that I did a higher amount of cracking active jokes in the classes where I was itching to get up on the podium and deliver the lesson myself. I knew the material well enough from previous experience and general study in some of the classes that instead of the usual Lunatic half-trance of unrelated daydream in a class that doesn't fully engage the attention, I was daydreaming about the lesson plan I'd use if I were teaching the class.
I had a passive-aggressive way of getting my version of the lesson into the teacher's lesson. I'd ask a question for clarification when I already knew the point, but I knew that some of the people around me didn't. I mostly did it with analogies, ostensibly to check my own understanding of the material, but primarily for the benefit of those around me. "So if you try to stuff a string into a number data type, you get as much of a mess as if you'd tried to measure oil in a sieve? And if you put a number in a string data type, the string may be confused, but it'll take it, like pouring hot spaghetti into a measuring cup?" And then I'd see the click on the face of my severely ADHD classmate and know that while the teacher hadn't gotten through, I had. And I'd sit back, satisfied, as the teacher went on with the lesson.