[Python-Dev] Re: anonymous blocks

Andrew Koenig ark-mlist at att.net
Mon Apr 25 17:00:16 CEST 2005


>  Mixing both suggestions:
> 
>  from <target> as <value>:
>      <BODY>
> 
>  That resembles an import statement which some
>  may consider good (syntax/keyword reuse) or
>  very bad (confusion?, value focus).

I have just noticed that this whole notion is fairly similar to the "local"
statement in ML, the syntax for which looks like this:

	local <declarations> in <declarations> end

The idea is that the first declarations, whatever they are, are processed
without putting their names into the surrounding scope, then the second
declarations are processed *with* putting their names into the surrounding
scope.

For example:

	local
		fun add(x:int, y:int) = x+y
	in
		fun succ(x) = add(x, 1)
		
	end

This defines succ in the surrounding scope, but not add.

So in Python terms, I think this would be

	local: <suite> in: <suite>

or, for example:

	local: <target> = value
	in:
		blah
		blah
		blah





More information about the Python-Dev mailing list