PEP-308 a "simplicity-first" alternative
Christian Tismer
tismer at tismer.com
Wed Feb 12 21:50:12 EST 2003
More information about the Python-list mailing list
Wed Feb 12 21:50:12 EST 2003
- Previous message (by thread): PEP-308 a "simplicity-first" alternative
- Next message (by thread): PEP-308 a "simplicity-first" alternative
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Terry Reedy wrote: > "Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message > news:mailman.1045095195.25260.python-list at python.org... > >>From: Bengt Richter [mailto:bokr at oz.net] >> >>>I think I have an answer: >>> result = cond and {true_value} or false_value > > >>Yes, we got you the first three times <wink>. Your proposal >>1. Doesn't give any indication that the expression is >> a selection (i.e. the same as x and y or b). > > > Given that 'and' and 'or' are best described as conditional selection > operators (explaining this is another post not yet written), it is > straightforward that together they form a conditional selection > expression. I think I'm posting evolving messages about the same thing, but I more and more come to an insight: 'and' and 'or' are logical selection operators. They use the value of two objects to decide which one to carry on. Their visual appearance includes the logical operation on the arguments in a way, which is the reason for their names. If we now modify the true_value to become true all the time, then this is an abuse of the and operator, since it is no longer doing what it says, it is only carrying the right value's wrapper if the left value is true. This is a complete abuse of the language, and we should refuse to create work-arounds for it to make it work. "x and y or z" as a spell of "if x then y else z" is know to be wrong. But perfectly valid, if it is really meant in its logical sense (what it seldom is). "x and {y} or z" is a correct heal of the wrong logic, but it abuses "and" and its reader, since and is not intended to do a left test only. Being used like that, "and" is the wrong name, since we are not intending to "and" anything, we want a "then". From a logical POV, the correct spelling of a logical "if a then b" construct would translate to "not a or b". But this works in Pascal, not in Python, since the truth operators have to carry their original operators. I think this whole mixture of logic with objects is broken. ciao - chris -- Christian Tismer :^) <mailto:tismer at tismer.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/
- Previous message (by thread): PEP-308 a "simplicity-first" alternative
- Next message (by thread): PEP-308 a "simplicity-first" alternative
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list