A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/112420.html below:

why does the % string format operator only take tuples?

why does the % string format operator only take tuples? why does the % string format operator only take tuples?Clarence Gardner clarence at netlojix.com
Tue Apr 3 20:37:16 EDT 2001
On Tue, 03 Apr 2001, Ram Bhamidipaty wrote:
>
>
>Does anyone else think it would be a good idea of the % operator
>were extended to also handle lists?
>
>-Ram

You want as few types as possible to be treated as containers for the
data to be formatted, because you have a problem formatting an object
of those types.

For example, if you want to print the tuple (1,2), you can't use
    print '%s' % (1,2)
Instead, you have to do something like
    print '%s' % `(1,2)`
Making % treat lists as tuples would just mean there were more objects
that can't be formatted.

More information about the Python-list 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