brownplt / lambda-py

Other
58 stars 10 forks source link

Bug: Stararg must be tuple #19

Closed akov closed 11 years ago

akov commented 11 years ago

Line 96 of interp assumes that starargs will be passed in the form of a tuple which is not necessarily true. This was done because we only needed starargs in the context of unpacking varargs which are stored in a tuple.This code needs to be generalized probably to be able to support anything with a __getitem__.

This should currently work with the tuple assumption:

def fun(*args):
  print(args[0])

fun(1,2)

But this will not but should:

def fun(a,b):
  print(a+b)

fun(*[1,2])