On Jun 25, 2020, at 21:33, Gregory P. Smith <g...@krypto.org> wrote:
> I prefer "or" to "|" as a combining token as there is nothing bitwise going 
> on here.  "or" reads better.   Which is why Python used it for logic 
> operations in the first place.  It is simple English.  "|" does not read like 
> or to anyone but a C based language programmer.  Something Python users 
> should never need to know.

Hasn't "|" been used in a similar way for decades in Unix/POSIX shell patterns, 
including with the shell case statement?

>From IEE Std 1003.1 -> Shell Command Language:
"The conditional construct case shall execute the compound-list corresponding 
to the first one of several patterns (see Pattern Matching Notation) that is 
matched by the string resulting from the tilde expansion, parameter expansion, 
command substitution, arithmetic expansion, and quote removal of the given 
word. The reserved word in shall denote the beginning of the patterns to be 
matched. Multiple patterns with the same compound-list shall be delimited by 
the '|' symbol. The control operator ')' terminates a list of patterns 
corresponding to a given action. The compound-list for each list of patterns, 
with the possible exception of the last, shall be terminated with ";;". The 
case construct terminates with the reserved word esac (case reversed).

The format for the case construct is as follows:

case word 
in
   
 [(] pattern1 ) compound-list 
;;
   
 [[(] pattern[ | pattern] ... ) compound-list ;;] 
...
   
 [[(] pattern[ | pattern] ... ) compound-list]

esac
"

case ${branch} in
    37|3.7) pushd "$HOME/dev/37/source" ;;
    38|3.8) pushd "$HOME/dev/38/source" ;;
    39|3.9) pushd "$HOME/dev/39/source" ;;
    3x|3.x|master) pushd "$HOME/dev/3x/source" ;;
    *) echo "unknown branch ${branch}" ;;
esac

   
--
  Ned Deily
  n...@python.org -- []
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/URONXXII7H3AIP735HT5KVWZBILGLQG5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to