The polynomial length imposition is because you are modeling the machine as a universal turing machine.
In thi case, the output "tape" would have to be of polynomial length.
It is not because you are using a modern language and expecting polynomial length results.