1

Resolved

Analysis ignores function decorators

description

Given this code:

def as_list(fn):
. . return lambda: list(fn())

@as_list
def items():
. . yield 1
. . yield 2
. . yield 3

x = items()

print(type(x), x)

The output will be "<type 'list'> [1, 2, 3]", but hovering over x will say it is a generator.


This code is functionally equivalent, but is analysed correctly:

def _items():
. . yield 1
. . yield 2
. . yield 3
items = as_list(_items)

x = items()

print(type(x), x)

comments

Zooba wrote Feb 15 at 5:56 PM

Fixed in 2.0 feature branch.