[Python-Dev] "as" mania
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Mar 8 01:42:11 CET 2006
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 +--------------------------------------+
More information about the Python-Dev
mailing list