candide wrote: > Le 08/10/2011 14:01, Steven D'Aprano a écrit : > > > And "not in" is the obvious way to do it. > > Obvious ? Not so. I performed some code mining and it appears that even > good sources make use of "not (foo in bar)" expressions.
All that proves is that even expert Python developers can, on occasion, write non-idiomatic Python -- or that they accept code contributed by non-expert Python developers, and don't bother adjusting trivial stylistic flaws. When I learned Pascal 20+ years ago, it took me a long time to stop writing "x not in y" and learn the non-English-like "not x in y". Then I learned Python, and it took me a while to stop writing Pascal code in Python. Bad habits take a while to disappear. (I never added superfluous semi-colons after each line though!) -- Steven -- http://mail.python.org/mailman/listinfo/python-list