A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-September/056050.html below:

[Python-Dev] Replacement for print in Python 3.0

[Python-Dev] Replacement for print in Python 3.0Charles Cazabon python at discworld.dyndns.org
Fri Sep 2 16:20:44 CEST 2005
Fredrik Lundh <fredrik at pythonware.com> 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                           <python at discworld.dyndns.org>
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4