[Python-Dev] in (original) (raw)
Ethan Furman ethan at stoneleaf.us
Tue Apr 3 19:34:58 EDT 2018
- Previous message (by thread): [Python-Dev] Hi, I am amar :)
- Next message (by thread): [Python-Dev] in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This behavior was recently brought to my attention [1]:
--> 1 in 'hello' Traceback (most recent call last): File "", line 1, in TypeError: 'in ' requires string as left operand, not int
However, in any other collection (set, dict, list, tuple, etc), the answer would be False.
Does anyone remember the reason why an exception is raised in the string instance instead of returning False?
--
Ethan
[1] https://bugs.python.org/msg314900
- Previous message (by thread): [Python-Dev] Hi, I am amar :)
- Next message (by thread): [Python-Dev] in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]