[Python-bugs-list] [ python-Bugs-735276 ] tuple.__mul__ won't work with string format

SourceForge.net noreply@sourceforge.net
Fri, 09 May 2003 08:20:10 -0700


Bugs item #735276, was opened at 2003-05-09 16:09
Message generated for change (Comment added) made by mwh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=735276&group_id=5470

Category: Python Interpreter Core
Group: Python 2.1.1
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Clark Updike (cupdike)
>Assigned to: Michael Hudson (mwh)
Summary: tuple.__mul__ won't work with string format

Initial Comment:
Tuple multiplication doesn't feed string format properly.

Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license" for more 
information.
>>> '%s%s' % ('x','x')
'xx'
>>> ('x',)*2 == ('x','x')
1
>>> '%s%s' % ('x',)*2
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: not enough arguments for format string
>>> '%s%s' % tuple(('x',)*2)
'xx'
>>>

----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2003-05-09 16:20

Message:
Logged In: YES 
user_id=6656

* and % have the same precedence and associate to the left:

>>> '%s%s' % (('x',)*2 )
'xx'

(there's a rant in here about overloading operators, but
I'll save that for another time...)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=735276&group_id=5470