On Feb 18, 12:58 pm, [EMAIL PROTECTED] wrote:
> Thank you in advance for your response.
> Dmitrey

The Python equivalent to "varargin" is "*args".

def printf(format, *args):
    sys.stdout.write(format % args)

There's no direct equivalent to "varargout".  In Python, functions
only have one return value.  However, you can simulate the effect of
multiple return values by returning a tuple.

"nargin" has no direct equivalent either, but you can define a
function with optional arguments by giving them default values.  For
example, the MATLAB function

function [x0, y0] = myplot(x, y, npts, angle, subdiv)
% MYPLOT  Plot a function.
% MYPLOT(x, y, npts, angle, subdiv)
%     The first two input arguments are
%     required; the other three have default values.
 ...
if nargin < 5, subdiv = 20; end
if nargin < 4, angle = 10; end
if nargin < 3, npts = 25; end
 ...

would be written in Python as:

def myplot(x, y, npts=25, angle=10, subdiv=20):
    ...

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to