Dec-30-2018, 01:48 AM
(This post was last modified: Dec-30-2018, 01:55 AM by Drone4four.)
(Dec-26-2018, 05:02 PM)Gribouillis Wrote: What about
def lesser_of_two_evens(a, b): return sorted((a, b))[(a | b) & 1]
Would someone care to explain in english sentences this function? I see are two variables (a and b). I see that the built-in sorted function is invoked. I see a tuple and a pipe, in addition to a conjunction and the integer
1
. That's about as much as I can understand. Would someone care to translate this python syntax into plain english? What is really throwing me off is the pipe. This SO question (and ensuing answers from the community) on Python and the pipe operator I find only a little helpful.