Proposed PEP for a Conditional Expression
thp at cs.ucr.edu
thp at cs.ucr.edu
Wed Sep 12 07:34:54 EDT 2001
Terry Reedy <tjreedy at home.com> wrote:
: <thp at cs.ucr.edu> wrote in message news:9nkvss$cmq$1 at glue.ucr.edu...
:> : WORKAROUND_2: (this SOMETIMES works)
:> : > x = c and a or b
:> The problem of determining whether or not a given expression ever
:> evaluates to false is equivalent to determining whether a given
: Turing
:> machine halts, i.e., the general case is not algorithmically
: solvable.
: True, but so what? Most real examples seem to involve constants that
: are triviallly either true or false or simple expressions that are
: trivial to decide in context.
I agree that "most" real examples fall into this category, but we
still need a general selection operator for the rest.
Also, using the short-circuited evaluation of logical operators for
selection is something of a hack. Sure it's an idiom that people
can get used to, but I would prefer code to say what it means more
directly.
Tom Payne
More information about the Python-list
mailing list