Package: pychecker
Version: 0.8.17-9
Severity: normal

For this, IMHO correct, however useless, code:

def foo(l):
    return "".join(map(lambda x: "%d" % (l[x]), l))

print foo((0,1,2))

I get this warning from pychecker:

map.py:4: Invalid arguments to (map), got 1, expected at least 2

Interestingly, I don't get the warning, if I rearrange the
function to either:

def foo(l):
    m = map(lambda x: "%d" % (l[x]), l)
    return "".join(m)

or:

def bar(e):
    return "%d" % (e)
def foo(l):
    return "".join(map(bar, l))

or:

def bar(x):
    return (0,1,2)[x]
def foo(l):
    return "".join(map(lambda x: "%d" % bar(x), l))

It seems, the combination of join(), map(), lambda, and a
reference to a list confuses pychecker.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to