Python is a language meant to be clear and readable without any ambiguities and unexpected behaviors. Unfortunately, these goals are not achievable in all cases, and that is why Python does have a few corner cases where it might do something different than what you were expecting.

This section will show you some issues that you might encounter when writing Python code.

List multiplication and common references

Mutable default argument

Changing the sequence you are iterating over

Integer and String identity

Dictionaries are unordered

Variable leaking in list comprehensions and for loops

Chaining of or operator

sys.argv0 is the name of the file being executed

Accessing int literals attributes

Global Interpreter Lock GIL and blocking threads

Multiple return

Pythonic JSON keys