On 04.07.2018 21:18, Steven D'Aprano wrote: > Read the Appendix to the PEP: > https://github.com/python/peps/blob/master/pep-0572.rst Yes, I did after I realized where that example came from. But my point was actually to understand the evaluation order because Uncle Timmy won't be around to explain when new code appears. > And no, total is not always not equal to total. Err, yeah. Double negation rules. ;-) > I read it as: > > while total != updated total: > do stuff > > and find it easier to follow than having to juggle the extra > book-keeping "old" variable in the original code. updated_total rocks. Reminds me of those pattern, we usually use in those cases. What just confused me is the evaluation order. It seems to me that it's like left-to-right first and then assignment expression. Using some math-style-inspired markers (execution-irrelevant) would be cool: while total != (total' := total + term): do stuff total and total' can be different at the same whereas total is total (at least in my mental model). But it seems I need to adapt here. Regards, Sven
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4