'in' operator
Joshua Marshall
jmarshal at mathworks.com
Tue Feb 20 09:47:12 EST 2001
More information about the Python-list mailing list
Tue Feb 20 09:47:12 EST 2001
- Previous message (by thread): 'in' operator
- Next message (by thread): What to do after Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Terry Reedy <tjreedy at udel.edu> wrote: > "Walter Moreira" <walterm at cmat.edu.uy> wrote in message > news:mailman.982374799.24358.python-list at python.org... >> Why the following test raise an error? >> >> >>> '' in 'yY' >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> TypeError: 'in <string>' requires character as left operand > Precisely for the reason stated. A character is a string of length 1. A > null string (of length 0) is not a character. Neither are strings of > length >= 2 [for which one must use find() or match()]. Wouldn't it be more natural for this to be a ValueError? There is no character type in Python -- '', 'y', and 'yY' are all strings.
- Previous message (by thread): 'in' operator
- Next message (by thread): What to do after Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list