In Harry Potter and the Half-Blood Prince, Harry seems to struggle in Snape’s class despite having personally fought dark wizards and monsters many times and survived. He even expects to do poorly on a dementor essay, despite being able to cast the patronus charm:
Having wasted a lot of time worrying aloud about Apparition, Ron was now struggling to finish a viciously difficult essay for Snape that Harry and Hermione had already completed. Harry fully expected to receive low marks on his, because he had disagreed with Snape on the best way to tackle dementors, but he did not care … (page 448, American hardcover edition)
Does this make any sense? At first glance, no. After Harry learns the patronus charm in Prisoner of Azkaban, no alternative ways of fighting off dementors are ever presented. It’s obvious why Snape doesn’t want to teach his students to cast a patronus: his love for Lily is his most deeply-buried secret, and the form of his patronus makes it obvious. But if Harry could disagree with him on how best to deal with a dementor, there must be another method he prefers.
In fact, since very few dark wizards can cast a patronus, I think there must be another method that relies on something besides love and happiness. Voldemort forms an alliance with the dementors in Order of the Phoenix, and yet neither he nor any of his followers seem to be tormented by them. It’s true that the dementors are dark creatures, and the Death Eaters’ allies, but if bad people weren’t affected by them, Azkaban wouldn’t be the nightmare it’s portrayed as. Or at least, it would only be a nightmare for the innocent.
Still, there is one character who manages to stay sane through his years in Azkaban: Sirius. Near the end of Prisoner of Azkaban, he tells Harry: “I think the only reason I never lost my mind is that I knew I was innocent. That wasn’t a happy thought, so the dementors couldn’t suck it out of me … but it kept me sane and knowing who I am …” Later, he describes that finding out Peter Pettigrew was at Hogwarts in his rat form “was as if someone had lit a fire in my head, and the dementors couldn’t destroy it … it wasn’t a happy feeling … it was an obsession … but it gave me strength, it cleared my mind” (371-372, paperback)
It cleared his mind? That sounds a lot like occlumency, which – as described by Snape in Order of the Phoenix – “seals the mind against magical intrusion and influence” (530, paperback). When Snape attempts to teach Harry occlumency, he continually tells him to clear his mind of emotion in order to shield it. Perhaps Snape’s way of dealing with dementors is to use something similar to occlumency against them, clearing his mind and focusing on something powerful yet not happy, much like Sirius did when he was in Azkaban. It wouldn’t do any good against the Dementor’s Kiss, but it could help against the misery they spread. And Harry, who never mastered occlumency, would certainly have disagreed that such a method was better than casting a patronus.
In Harry Potter and the Cursed Child – SPOILER WARNING – Snape and Scorpius encounter dementors in the world ruled by Voldemort and get past them without ever casting a patronus. It makes sense that they can’t, since Snape’s would reveal his true loyalty and Scorpius has never learned how. And, of course, being who they are, casting a patronus would make them look suspicious rather than protecting them, something that is true of Snape throughout the Harry Potter books. However, the way the scene plays out is interesting: while Scorpius begins describing the effects of a dementor and hears his mother dying, Snape seems totally unaffected and tells Scorpius to “stay calm” and “think of something else”. “Think about why you’re doing this”.
SNAPE: Think about Albus. … All it takes is one person. I couldn’t save Harry for Lily. So now I give my allegiance to the cause she believed in. And it’s possible – that along the way I started believing in it myself.
SCORPIUS smiles at SNAPE. He steps decisively away from the dementor.
SCORPIUS: The world changes and we change with it. I am better off in this world. But the world is not better. I don’t want that. (141, Nook edition)
Like Sirius’ fixation with his innocence, these are not happy thoughts. Snape’s actions led to the death of the woman he loved, and in this timeline, he was also unable to save her son. Scorpius accidentally erased his best friend from existence and created a world like something out of a nightmare. Those are the kind of thoughts a dementor would remind you of, not ones they would drain away, and yet they would act as a sort of anchor to reality.
It would be easy to write off that scene as making no sense, because protecting yourself from a dementor without casting a patronus shouldn’t be possible. But it always has been possible. Sirius was able to retain his sanity and eventually escape from Azkaban by focusing on something that, while not happy, reminded him of who he was. Snape disagreed with Harry on how to deal with dementors, and presumably, that means he did have a different method that he considered effective enough to shield his mind from them. Could it have been something like what he and Scorpius do in Cursed Child? I don’t see why not.