[Python-ideas] @return?

Conrad Irwin conrad.irwin at googlemail.com
Thu Apr 15 13:03:17 CEST 2010


On 04/15/2010 07:10 AM, Masklinn wrote:
> On 15 Apr 2010, at 01:33 , Conrad Irwin wrote:
>> I am also slightly against truly
>> "anonymous" functions, if it doesn't fit inside a lambda, the name at
>> least provides some compulsory documentation
> 
> Isn't that statement a bit disingenuous when considering that `for` or
> `with` blocks can contain arbitrary complexity and not require any kind
> of naming?
> 
>> and a reference point while debugging.
> 
> that can be useful, but again it's not like most python source provides
> that.

The thing I fear is ending up with a stacktrace like:

Traceback (most recent call last):
  File "a.py", line 10, in <module>
    event('complete')
  File "a.py", line 6, in event
    def event(*args): [callback(*args) for callback in cbs]
TypeError: <anonymous>() takes no arguments (1 given)

In general, it is going to take a while to find out what <anonymous> is,
and where it came from, and why it has the wrong signature. Because you
can't pass with/for blocks around there is little need for them to carry
their documentation with them. Obviously it's not impossible, it's just
not pleasant either.

Conrad



More information about the Python-ideas mailing list