in Opperator
In regular python, in
opreators on lists, objects, and generally any container object. It also supports overloading via the __contains__
method.
Transcrypt's in
operator supports neither of these things. In order to achieve better performance when used with dicts (javascript "object"s), it behaves very similarly to JavaScript's in
operator.
It will work the same on dictionaries, but does not support lists, and does not support custom containers.
To find whether a list contains an item or a string contains a sub-string, one can use the includes
method:
Last updated
Was this helpful?