Dying is easy but comedy is hard, as the saying goes. I’m not sure where drama fits in, but Anna Boden and Ryan Fleck, the writing and directing team who made Half Nelson (2006) and Sugar (2008), create a fine ensemble cast for this third feature by combining skilled character actors (Viola Davis, Jeremy Davies, Adrian Martinez) and professional comedians playing straight (Zach Galifianakis, Jim Gaffigan, Aasif Mandvi). The resulting story, about a depressed high schooler (Keir Gilchrist) who naively checks himself into a hospital psychiatric ward and then discovers he has to stay five days for observation, inhabits that wonderful and elusive space between comedy and drama where genuine human behavior resides. Ultimately the kid’s problems are less interesting than the whackos surrounding him, but that prevents the movie’s coming-of-age narrative from becoming too pat: like the space between comedy and drama, the one between sanity and insanity is where real life takes place.

It’s Kind of a Funny Story opens in Chicago on October 8.