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

Hamish Lawson hamish_lawson at yahoo.co.uk
Tue Oct 16 19:44:08 CEST 2001

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

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).

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.

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

More information about the Python-list mailing list