None in string => TypeError?

Ryan Hiebert ryan at ryanhiebert.com
Mon Jun 9 11:42:08 EDT 2014


On Mon, Jun 9, 2014 at 10:34 AM, Roy Smith <roy at panix.com> wrote:

> We noticed recently that:
>
> >>> None in 'foo'
>
> raises (at least in Python 2.7)
>
> TypeError: 'in <string>' requires string as left operand, not NoneType
>
> This is surprising.
>
> It's the same in 3.4, and I agree that it's surprising, at least to me
​. I don't know the story or implementation behind it, so I'll leave that
to others.​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140609/7d392661/attachment.html>


More information about the Python-list mailing list