Does Python have equivalent to MATLAB "varargin", "varargout", "nargin", "nargout"?
Andrew McLean
andrew-news at andros.org.uk
Sun Feb 18 14:48:09 EST 2007
Where you would use varargin and nargin in Matlab, you would use the
*args mechanism in Python.
Try calling
def t1(*args):
print args
print len(args)
with different argument lists
Where you would use varargout and nargout in Matlab you would use tuple
unpacking in Python.
Play with this
def t2(n):
return tuple(range(n))
a, b = t2(2)
x = t2(3)
More information about the Python-list
mailing list