no, this is different; it’s not for booleans, but for assertions, and could be used for e.g. exhaustive switches, e.g. it would make the first test in the following unnecessary:

if spam not in {"a", "b", "c"}:
    throw new ValueError("spam {} should be a, b, or c!".format(spam))
if spam == "a":
    foo()
elif spam == "b":
    bar()
else:
    baz()

i’m not saing i support the idea though. i’d rather see scala-like extensible pattern matching. that would solve this, the eternal switch debate, and more (using extractors).

is there a proposal for pattern matching? if not, i’ll come up with one ;)


2013/4/18 Yaroslav Fedevych <yaroslav@fedevych.name>
An obligatory read for anyone who comes up with ideas like this: http://thedailywtf.com/Articles/ButAnything-Can-Happen!.aspx

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas