explain why adding a new builtin won't work.

This commit is contained in:
Skip Montanaro 2003-02-07 20:18:45 +00:00
parent d163abe4d6
commit cd1746477e
1 changed files with 9 additions and 0 deletions

View File

@ -98,6 +98,15 @@ Alternatives
advantage of evaluating strictly from left to right (not that that advantage of evaluating strictly from left to right (not that that
is a requirement for being Pythonic -- list comprehensions don't). 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 Copyright