On 9/2/05, Charles Cazabon <[EMAIL PROTECTED]> wrote:
> 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')
Ouf, I'm just feeling an evil idea creeping up just now:
print('foo:', foo, 'bar:', bar, 'baz:', baz,)
Just kidding, really...
Funny enough, the syntax does not barf and goes undetected:
>>> def foo( a, b, c ):
... print a, b, c
...
>>> foo(1, 2, 3,)
1 2 3
>>>
_______________________________________________
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