Alex Martelli wrote: > On Mar 7, 2006, at 6:15 AM, Georg Brandl wrote: >>with expr as f: >> do something with f I expect the "with" example here is a red herring, not intended to have anything to do with the new "with" statement that's just been added. > I think the best use cases for 'assignment inside an if or while' > condition, as far as they go, require `capturing' a SUB-expression of > the condition, rather than the whole condition. E.g., in C, > > while ( (x=next_x()) < threshold ) ... IIUC, that would be while (next_x() as x) < threshold: ... i.e. 'x as y' would be an expression. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing at canterbury.ac.nz +--------------------------------------+
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