[Python-ideas] @return?

Mathias Panzenböck grosser.meister.morti at gmx.net
Thu Apr 15 21:30:03 CEST 2010


On 04/15/2010 08:07 PM, Conrad Irwin wrote:
 >
 > It's hard to see that an alternative syntax for scoping a block is going
 > to be acceptable. A syntax like "@return", couple with expanding the
 > allowable forms of the def name solve many issues. Perhaps the only
 > remaining "missing" feature is passing functions to functions, though I
 > think that could be done with something like a "call" block:
 >
 > call filter:
 >      def lt(x):
 >          return x<  2
 >      [1,2,3,4]

maybe just:

filter(lt,[1,2,3,4]):
	def lt(x):
		return x < 2

or

filter(lt,[1,2,3,4]) where:
	def lt(x):
		return x < 2

basically something like where in haskell. but then dis doesnt save much, just reverses the order of 
the statements (and possibly removes lt from the scope after filter was called). is that really enough?

	-panzi



More information about the Python-ideas mailing list