Congrats to Chris for breaking his PEP curse

Steven D'Aprano steve+comp.lang.python at
Wed Jul 4 21:40:46 EDT 2018

On Wed, 04 Jul 2018 16:23:31 -0600, Ian Kelly wrote:

>> >> group = if match := re.match(data) else None
>> There's no stopping some people from making poor naming choices. Surely
>> the standard name for match objects is "mo", not match?
> I was referring to the variable "match" being referenced spatially prior
> to its assignment, not to the naming.

Oh. Well, that's the way ternary if works.

Not everything in Python uses a strict left-to-right reading order. Just 
like English really.

>> But if people were going to write that, surely they would now write:
>>     match = re.match(pattern, data)
>>     group = if match else None
> Er, I think you're missing the point of the example from the PEP

No, I missed the point *you* were making. I thought you were complaining 
about the visual confusion of having a variable called match and a method 
called match. 

Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

More information about the Python-list mailing list