What Are the Most Common Mistakes People Make with Syntax in Python? or How Important Is Proper Synta

14 Replies, 1068 Views

Dude, the walrus operator `:=` still feels like black magic to me. Why does `if (n := len(my_list)) > 10:` work? It’s like assigning and checking at the same time. So handy but so weird at first glance.

Also, string interning! `"hello" is "hello"` is `True` but `"hello world" is "hello world"` can be `False` depending on how Python decides to cache strings.

If you wanna dive deeper, Real Python has a great article on syntax in python quirks. Their explanations are *chef’s kiss*.

Messages In This Thread



Users browsing this thread: 1 Guest(s)