reflex reaction:
+1 40D.
It is the better camera. Much nicer viewfinder, better digic processor (14 bit colour) better construction, better handling, better AF (more points, better points) faster blah blah blah.
A lens could be picked up cheaply enough (nifty fifty or used 18-55 IS) and would be a great combo.
But.
Thats the spec sheet talking.
It's your hands using it.
Go into a shop, try a current rebel like the T3, try a current x0D body, the 7D is probably closer in terms of weight and construction to 40D.
Decide which fits your hand best. Try the controls. Hold it to your eye. Make a decision. Based on that buy the rebel or the 40D.