implement print output in a more pythonic way