Marcin Ciura wrote:
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



Since you're teaching python, why not teach the python way instead of inventing a new way.

print 'The phone number is (%s) %s' % (extension, number)

IMO is by far the superior and clearest way for string concatenation for any purpose eg. printing or assignment. This would mean you are making your students lives easier by showing them one good method of doing string concatenation which can be applied to printing as well.

Huy
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to