Agree with Dustin and others on the pancake...Overall I say it's a far better lens than the "nifty fifty". Although I'm not sure how much better the transition from focus to out-of-focus the 40mm is than the 50mm f/1.8. The 50 has a shorter transition area which helps it, at least when set to faster aperture than f/2.8...besides being a slightly narrower field of view...which also makes this transition area faster/shallower. But the 50's bokeh fringing (or longitudinal CA) is far more pronounced at these faster apertures...and always looked ugly to me.
The 50 has more color saturation, but it is a bit less neutral to my eyes.
The main reasons I prefer the pancake to the 50 1.8, are the higher sharpness (to the FF corners), and the slightly wider field of view...which is far more useful for landscape and close range portraiture than the 50's is. Also, after I sold the "nifty fifty", I bought the Voigtlander 58mm Nokton SLii f/1.4. I vastly prefer its color, contrast, and sharpness...to both the pancake and the "nifty fifty". Its actual focal length at infinity focus is more like 53 or 54mm, rather than 58. However, it's a manual, Nikon-mount lens, so there are drawbacks...but I found them worthwhile. The bokeh smoothness isn't much better than the Canon 50mm f/1.8's, but it is better, and certainly even more extreme at f/1.4. It's not perfect, but it's the choice I made...and I also prefer it to the current (old) Canon 50mm f/1.4. The f/1.2L would be the better choice for sole use as a portrait lens, obviously...but then it costs 3x the price of the Voigt, and 8x the price of the pancake...and portrait shooting isn't always high on my list...certainly not professionally at this time.