that sounds big enough, 40 inches is over three feet isn't it? (its been a long day in work) hehe. I think three feet is usually considered the minimum acceptable size in the UK, it may differ elsewhere.
That size tank should be acceptable all its life, what acceptable is however varies from person to person though.
The rule i've heard before is to try and keep your snake in a vivarium thats at least 2/3's the length of the snake.
That size tank would be too big for a non adult though. Using larger tanks with hatchlings etc. can cause stress and may lead to you not seeing your snake very much.