daviis / PyDucker

A static ducking tool for python 3 source code
2 stars 2 forks source link

Call function with starargs #80

Closed daviis closed 9 years ago

daviis commented 9 years ago

If a function looks like this and is called like below it will work.

def hi(a, b):
    print(a)
    print(b)

hi(*(1,2))

But because we are not keeping track of the length of lists and such we don't know if it is filling the available positional arguments.

What we can do is raise a PyDuckerWarning about not knowing if it is fulfilled 100%.

daviis commented 9 years ago

43

daviis commented 9 years ago

If a list is seen for star args and it is homogeneous then the length is assumed good and so long as the types match then it lets everything pass.

If it isn't homo then it will throw an exception.