3 ms·
"""that "x not in y" is worth having in a language when it's identical to "not x in y"""" It's not identical. Their effects are identical --which is a differen
by dextorious 15y ago
"""that "x not in y" is worth having in a language when it's identical to "not x in y""""
It's not identical. Their effects are identical --which is a different thing.
With turing completeness you could do with even less, but that's not the point.
The point is: "x not in y" is more natural -- and Python is praised for it's ability to read like natural language/pseudocode (which it doesn't always achieve, but this is one case that it does).
We say: "if my tie is not in the suitcase, do something".
We don't say: "if not is my tie in the suitecase, do something" (except Yoda).
- esrauch 15y agoThe question I am raising is not whether "x not in y" is more natural looking than "not x in y", I completely 100% accept that it is. My question is that why is it that people consider it to be so sufficiently natural looking that it demands it's own semantics when "unless x:" is considered to be abominable. You completely did not respond to what I wrote; I say "until and unless are just as much more natural compared to the way you currently implement them, as (x not in y) is compared (not x in y)" and you say "(x not in y) is natural!". That doesn't show my claim isn't true, to be an argument against my claim you have to also claim that people don't say "until you are done, do next thing". Or that people don't say "do the next thing until you are done", or "bake cookies until done"; python has no do-while construct much less do-until. So again; why is that "not in" is sufficiently important to be a language feature but do-until is hideous and unnatural?