Extending Python Syntax with @

Raymond Hettinger python at rcn.com
Thu Mar 11 17:15:57 EST 2004


[David MacQuigg]
> print @(separator = None) x, y, z

For this particular example, you might get farther by proposing a
builtin print function that takes optional keyword arguments:

def newprint(*args, separator=' ', destination=sys.stdout):
   print >> destination, separator.join(args)

Guido at one time wished that print was a function instead of a
statement.  Here's your chance to push that idea forward.

Using a function instead of a statement is inherently more flexible,
easier to extend, and helps address a couple of micro-warts (i.e. a
handful of people hate the automatic spacing, and more than a handful
hate the >> notation).


Raymond Hettinger



More information about the Python-list mailing list