D40 is an older model released in 2006. DPReviews
has a nice review on it. Before I go further, I will give the disclaimer that asking what camera to buy is like asking what car to buy. You would really benefit from going to a properly stocked photography store and laying hands on each that you're considering and finding what feels right to you. As such, everything I write below is solely my opinion as a highly interested amateur photographer.
6MP is a little low for even an entry level SLR nowadays. Should be fine if you're looking to keep everything digital. If you're looking to make prints, you might consider going with something at a higher megapixel count. Not that you can't make decent sized prints with 6MP, but if you plan to crop because of a "short" lens, you might limit yourself.
Also, newer Nikon and Canon SLRs have improved low light performance at high ISO, potentially important to you if you plan on making photographs indoors or at dusk or sunrise.
Looking at the cons in the Dpreviews, I might be concerned about the lack of the ability to do auto-exposure bracketing. I don't know if making HDRs is something you're interested in doing, but having AE bracketing makes it easier to do.
Something else to think about is that when you choose a brand of SLR, you're kind of marrying yourself to their lens line as well. Nikon and Canon make expensive lenses, but as your skills grow, those same lenses will work on their more expensive camera bodies.
Personally, I know that I'll never be a professional photographer. I have stuck with the Olympus line because they are relatively less expensive than comparable Nikon or Canon. They build image stabilization into the camera bodies which makes the lenses a bit less expensive. The four-thirds sensor that Olympus and Panasonic use allows for relatively smaller camera bodies and lenses (kind of a big deal if you're traveling a lot). My personal kit is an Olympus E510 with mid-range Zuiko lenses. (some samples below at low resolution). Just goes to show that you don't need thousands of dollars worth of equipment or a Canon or Nikon to make great photographs.
Last thing to remember is that the camera or the lens does not make the photograph. It's the photographer who must compose, snap and process. Almost all modern SLRs have the technical ability to make beautiful photographs, but bad composition will ruin any picture.