From cd1746477ebd4bb1134545a67208f41a5cdb41b5 Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Fri, 7 Feb 2003 20:18:45 +0000 Subject: [PATCH] explain why adding a new builtin won't work. --- pep-0308.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pep-0308.txt b/pep-0308.txt index 5239cf751..af72bcfe4 100644 --- a/pep-0308.txt +++ b/pep-0308.txt @@ -98,6 +98,15 @@ Alternatives advantage of evaluating strictly from left to right (not that that is a requirement for being Pythonic -- list comprehensions don't). + Many people suggest adding a new builtin instead of extending the + syntax of the language, e.g.: + + ifelse(condition, expression1, expression2) + + This won't work the way a syntax extension will because both + expression1 and expression2 must be evaluated before the function + is called. There's no way to short-circuit the expression + evaluation. Copyright