From 648a2a5acc3b35fa746225c5cfdf85070cd5a221 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 7 Feb 2003 22:29:39 +0000 Subject: [PATCH] Explain that "e if C" (without the "else" part) is a bad idea. --- pep-0308.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pep-0308.txt b/pep-0308.txt index 941465cc5..130721741 100644 --- a/pep-0308.txt +++ b/pep-0308.txt @@ -110,6 +110,18 @@ Alternatives is called. There's no way to short-circuit the expression evaluation. + +Variations + + It has been proposed to make the 'else' part optional. This would + be a really bad idea. I showed: + + x = e if C + + to several people and they all thought that if C was false, it + would leave x unchanged. So don't even think about this one! + + Copyright This document has been placed in the public domain.