[Python-bugs-list] [ python-Feature Requests-549187 ] error about string formatting rewording?

noreply@sourceforge.net noreply@sourceforge.net
Sat, 27 Apr 2002 20:39:11 -0700


Feature Requests item #549187, was opened at 2002-04-26 17:24
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=549187&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Danny Yoo (dyoo)
Assigned to: Nobody/Anonymous (nobody)
Summary: error about string formatting rewording?

Initial Comment:
The error message that occurs during string formatting,
when one passes more arguments than necessary, is this:

    TypeError: not all arguments converted

It might be good to mention that this conversion is
taking place as a result of string formatting.  My
suggestions is to add a little more to this message:

    TypeError: not all arguments converted during
string formatting


The reason is because string formatting uses the same
operation as the modulus command, and also can take in
a single integer argument, like:

   ziffer = note % 10

Newcomers to the language often mix up string and
numbers, and the error message above can be very
cryptic if one doesn't know about string formatting
yet.  With the reworded error message, there's less of
chance of confusion.

See:

http://mail.python.org/pipermail/tutor/2002-April/014110.html

for more details on why this might be nice.  Thanks!

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

>Comment By: Danny Yoo (dyoo)
Date: 2002-04-28 03:39

Message:
Logged In: YES 
user_id=49843

Ok, I wrote up a patch to add more to the error message. 
Here's what it does:

>>> def isEven(n): return n % 2 == 0
... 
>>> isEven(17)
False
>>> isEven("17")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 1, in isEven
TypeError: not all arguments converted during string formatting

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=549187&group_id=5470