continuing my thoughts extempore on language syntax design… on python.

python has these operators on dictionary to check if a key exist:

① 「‹k› in ‹d›」 → return True if ‹d› has a key ‹k›, else False.
② 「‹k› not in ‹d›」 → same as above but reverse boolean

note that ② is not necessary. It can simply be done with 「not (‹k› in ‹d›)」.

the python way is idiotic. Because:

Now, the 「not」 operator has multiple meanings, depending on context. It compound on syntax complexity. Now, 「not in」 is actually a operator. Having English word acting as operator and not symbol or function is odd enough, but now that operator is 2 words, separated by space! So, syntactically, it becomes not distinguishable from statements, or the tens of idiosyncratic syntax of C such as its “for”, “while”.

this is the state of the affair of syntax soup. When you learn a language, there's little governing principle of what symbol can go where (as in formal language❕), instead, you learn by rote of what symbbols or words can go where in what context means what. 

but, the 「‹k› in ‹d›」 is itself idiotic. Python has a 「has_key()」 method, which is in sync with the 20 other methods on dict. Though, strangely, python decided to deprecate it, and in python 3, it's gone.

perm url
Python's Context Dependent Syntax Soup: 「… in …」 And 「… not in …」
Shared publiclyView activity