3 --0-- 5 == 8 and --5 == 5 are both semantically correct statements and evaluate to True.
Might want to add that ++a and --a are both valid Python (given a is a number), but isn’t what you probably think they are (increment/decrement).
'a'[0][0][0][0][0] is also a semantically correct statement as strings are iterable in Python.
This is possible because strings are sequences, not iterables (although they are iterables as well).
Multiple Python threads don't run concurrently (yes you heard it right!).
This is not accurate. Python threads do run concurrently, but can’t run Python code concurrently. A thread can execute if another is in the middle of non-Python code execution (e.g. waiting for the response of a network call).
Might want to add that
++aand--aare both valid Python (givenais a number), but isn’t what you probably think they are (increment/decrement).This is possible because strings are sequences, not iterables (although they are iterables as well).
This is not accurate. Python threads do run concurrently, but can’t run Python code concurrently. A thread can execute if another is in the middle of non-Python code execution (e.g. waiting for the response of a network call).