[Python-bugs-list] [ python-Bugs-486826 ] bogus error message on bad parameters

noreply@sourceforge.net noreply@sourceforge.net
Thu, 29 Nov 2001 10:23:00 -0800


Bugs item #486826, was opened at 2001-11-28 20:56
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=486826&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: bogus error message on bad parameters

Initial Comment:
I was writing a CGI and ran across the following error message: 
TypeError: 'in <string>' requires character as left operand, which 
drove me batty as I keep thinking it was the left operand when in 
reality it was the right operand....  I've simplified the problem to 

Python 2.1.1 (#1, Oct 30 2001, 09:41:48) 
[GCC 2.95.2 19991024 (release)] on darwin1
Type "copyright", "credits" or "license" for more information.
>>> mystrings = "AE,Developer"
>>> "AE" in mystrings
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: 'in <string>' requires character as left operand
>>> 

maybe it's just me but I keep thinking that "AE" is the left operand 
and it has a character.... 

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

>Comment By: Martin v. Löwis (loewis)
Date: 2001-11-29 10:23

Message:
Logged In: YES 
user_id=21627

I can't see the bug. Sure "AE" *has* a character (actually
two of them), but it *is* not a character - a character is a
string of length 1. You need such a thing on the left-hand
side of 'in <string>'.

How would you formulate the error message?

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

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