Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> >
> > print('foo:', foo, 'bar:', bar, 'baz:', baz,
> > 'frobble', frobble)
> >
> > To my (admittedly biased) eyes, the second version more obviously
> > prints to a single line.
>
> next use case:
>
> print 'foo:', foo, 'bar:', bar, 'baz:', baz,
> if frobble > 0:
> print 'frobble', frobble
> else:
> print 'no frobble today'
The need to print /and/ not add a newline isn't nearly as common. print()
could take a keyword parameter to skip the newline, or ...
print('foo:', foo, 'bar:', bar, 'baz:', baz,
frobble and 'frobble: ' + frobble or 'no frobble today')
Or the user can just use stdout.write and have full control.
Charles
--
-----------------------------------------------------------------------
Charles Cazabon <[EMAIL PROTECTED]>
GPL'ed software available at: http://pyropus.ca/software/
-----------------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com