News for hackers. Stuff that matters.
Re:Pattern matching accepted for Python by dpritchett on Tuesday February 09, 2021 @05:36PM (#26083374)
Are you sure the second one isn’t just declaring not_found as a stand-in for 404 so the case statement two lines below can refer to business logic rather than a “magic” constant?

I would NOT expect for the line “case not_found:” to reassign the status variable to 404 regardless of what it was before.

I can’t see how or why that would be intended behavior.

Re:Pattern matching accepted for Python by remram on Tuesday February 09, 2021 @06:10PM (#26083763)
It doesn't reassign the 'status' variable, it reassigns the 'not_found" variable.
Re:Pattern matching accepted for Python by pansa2 on Tuesday February 09, 2021 @06:02PM (#26083676)
> Are you sure the second one isn’t just declaring not_found as a stand-in for 404

That's what it looks like, but no, the refactoring really does change an equality test into an assignment.