Dnia 15-08-2009 o 22:50:39 Stef Mientki <stef.mien...@gmail.com> napisaƂ(a):

hello,

I'm not sure if  "unpacking" is the right term
but if I have a tuple of 2 arrays,
I can either call a function with:

          Space_State = tf2ss ( filt[0], filt[1] )

or with
          Space_State = tf2ss ( *filt )

Now if I've to call a function with more parameters,
why can't I use (Polynome is again a tuple of 2 arrays) :
(which already gives an error in the IDE)

          Respons = signal.lfilter ( *Polynome, Signal )

and thus I've to use:

          Respons = signal.lfilter ( Polynome[0], Polynome[1], Signal )

The content of that tuple or list (filt/Polynome here) doesn't matter.
Simply, when calling function, you can't put positional (non-keyword)
argument after *something.

 >>> def nic(*args, **kwargs): pass
 ...
 >>> nic(*[1,2,3], 4)
   File "<stdin>", line 1
 SyntaxError: only named arguments may follow *expression


That'd be ok:

 Respons = signal.lfilter(*Polynome, sig=Signal)  # if this method can
                                                  # receive argument
                                                  # 'sig' after more
                                                  # than len(Polynome)
                                                  # of arguments

--
Jan Kaliszewski (zuo) <z...@chopin.edu.pl>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to