The current discussion on conditional expressions has at times touched on the ever-recurring issue of assignment in expressions. It reminded me that a proposal by Kevin Digweed back in early 1999 had actually managed to obtain Guido's approval as a reasonably Pythonic approach to allowing assignment in expressions, and the proposal seemed intended to make its eventual way into Python. Is this still the case? Kevin's original proposal: | What about allowing an optional "assignment only" suite | between "while" and the test condition. This suite will be executed | before testing the condition each time | <http://groups.google.com/groups?hl=en&selm=78naok%242ed%241%40nnrp1.dejanews.com> Guido then expanded on the proposal and seemed to give it his approval: | Why stop there? It could easily be any number of "small" statements | separated by semicolons with the restriction that the final one must | be an expression and that the ones before it must not be flow-control | statements (return, raise, continue, break). Other useful statements | to allow are print (for debugging) and assert, and for all I care | import, del, pass, and exec. | | Note that I like this for 2.0, not so much for for 1.6 (if only | because I don't want 1.6 to make existing books obsolete). | <http://groups.google.com/groups?hl=en&selm=199902021501.KAA07333%40eric.cnri.reston.va.us> Guido also clarified its intended syntax and semantics: | In my interpretation, the expression (S1; S2; ...; Sn; E) yields the | value of expression E -- S1-Sn are only there for their side effects. | <http://groups.google.com/groups?hl=en&selm=199902031343.IAA09480%40eric.cnri.reston.va.us> Hamish Lawson ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie
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