'in' operator
Pearu Peterson
pearu at cens.ioc.ee
Sat Feb 17 04:21:05 EST 2001
On Sat, 17 Feb 2001, Rainer Deyke 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
> >
> > I would expect it to give 0, false.
>
> I would expect it to give 1, since "" is a substring of "yY". Given this
Me too, and because of the analogy:
`an empty set is a subset of every set'
`an empty string is a substring of every string'
Pearu
More information about the Python-list
mailing list