what's in a name (was Re: using lambda to print everything in a list)

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue May 1 04:44:38 EDT 2001


James_Althoff at i2.com wrote in
<mailman.988660184.7220.python-list at python.org>: 

> is really a preferred idiom.  In practice, I don't see folks around my
> block do the latter much, although there is nothing in today's Python
> that prevents it.  I do believe I would see this idiom used much more
> frequently (in my building anyway) were there something akin to:
> 
> window.showWaitCursorDuring:
>     line1-of-code
>     line2-of-code
>     . . .
>     lineN-of-code
> 
> By comparison, one does see this idiom used frequently in Smalltalk
> (and apparently from a recent post, in Ruby as well).

Microsoft have also added support for this idiom to C#. They have a using 
statement:
using-statement:
    	using ( resource-acquisition ) embedded-statement
resource-acquisition:
    	local-variable-declaration
    	expression

which wraps a try/finally around the statement and calls the Dispose method 
of the variable or object returned by the expression when the statement 
completes.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list