pre-PEP: Print Without Intervening Space

Marcin Ciura ciuraNOSPAM at zeus.polsl.gliwice.pl
Fri Mar 11 10:24:35 EST 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,
   Marcin




More information about the Python-list mailing list