pre-PEP: Print Without Intervening Space

Marcin Ciura ciuraNOSPAM at
Fri Mar 11 16:24:35 CET 2005

Duncan Booth wrote:
> import sys
> def nospace(value, stream=None):
>     '''Suppress output of space before printing value'''
>     stream = stream or sys.stdout
>     stream.softspace = 0
>     return str(value)

I'm teaching Python as the first programming language to non-computer
scientists. Many of the toy programs would be simpler with the double
comma syntax. Presently, having a choice whether to teach my students
the result += fn(x) way or your way, I would still opt for the former.

Best regards,

More information about the Python-list mailing list