[Python-ideas] @return?

Mathias Panzenböck grosser.meister.morti at gmx.net
Thu Apr 15 00:07:57 CEST 2010


On 04/14/2010 11:52 PM, Nick Coghlan wrote:
> Masklinn wrote:
>> On 14 Apr 2010, at 18:41 , Conrad Irwin wrote
>>> As I understand it, there is little desire to allow function definitions
>>> to appear "just anywhere" in Python.
>>
>> I don't believe that's true, but it is possible that people who express
>>   this desire are directed towards other languages.
>
> Limit the scope to "the core devs" and Conrad's statement is probably
> true :)
>
> The problem is that:
>
> 1. Whitespace is highly significant in delineating scope and separation
> at a statement level
>
> 2. Whitespace is largely insignificant at the expression level
>

Maybe only allow them at certain places where they can be seen as an extension to an already 
existing statement syntax (not to an expression syntax):

foo.bar = def(egg, spam):
	pass

return def(egg, spam):
	pass

yield def(egg, spam):
	pass


Anyway, if you'd introduce @return (which I'm -1 about) you'd need also to introduce @yield.

	-panzi



More information about the Python-ideas mailing list