I have a GTP and he's got a wonderful personality but that depends on the snake. Some are jerks, some are not. You will need a a specially suited cage for them (NOT a 40 gal tank) as they are entirely arboreal. Every function is done while perched. You will need a cage similar to this, with or without the extra plants. You'll need to be vigilant about the humidity and as previously mentioned they're generally considered more difficult to keep.
I think a lot of the snakes that have been suggested to you are good ideas. Sand boas are really cool and deceptively good at climbing. Why exactly do you want it to fit in a 40 gal tank? Do you have an extra you're trying to fill or is that just a representation of the size constraint you have? Why do you want an arboreal animal? For display or because you think it's behavior would be interesting to watch? More information will allow for people to make more informed suggestions.