On Tue, Jun 7, 2016 at 4:13 PM Nick Coghlan email@example.com wrote:
As a possible guide to designing the signatures for binding decorators, it's probably worth asking what would be needed to make:
@bindfunction f = lambda : None
def f(): pass
Since the interpreter already sets __module__ and __globals__ correctly on lambda functions, the main considerations would be to get f.__name__ and f.__qualname__ set correctly, which means just the immediate target would be insufficient - you'd also want the scope naming information that gets included in __qualname__, but is omitted from __name__.
The ``bindfunction`` function could look up the __module__ and use that to assign the __qualname__. Would that satisfy?