[Python-Dev] What happened to Guido's plans for (S1; S2; ...; Sn; E) ? (original) (raw)

Hamish Lawson hamish_lawson@yahoo.co.uk
Tue, 16 Oct 2001 17:59:29 +0100 (BST)


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