Private and public methods
are SAS Micro Analytic Service concepts, rather than Python features.
Any method having the "Output:" doc string is considered
a public method. If a method does not have the "Output:"
doc string, then it is considered a private method. SAS Micro Analytic
Service can host public and private Python methods, where a method
is a Python function. Although a private method cannot be called directly,
it can be called by another method (public or private). Private methods
are useful as utility functions. Private methods are not callable
externally. Therefore, they do not show up when querying the list
of methods within a package. However, they can be called internally
by other methods.
Python modules can be
published containing all public methods, or a mixture of public and
private methods. Both public and private methods can call other functions
that either exist within the module internally or in external Python
packages, including third-party libraries.
All public functions
returning more than one output argument must return a tuple containing
all of the output arguments. This can be done by returning all of
the arguments separated by commas. When returning zero arguments from
a public function you are still required to include the "Output:"
doc string to indicate a public function. It should simply be "Output:",
with no output arguments listed. You can omit the return statement,
return "None", or return an empty tuple.
An example of returning
an empty tuple is return ()
. An example of
returning "None" is return None
.
One output argument can be returned as is. It is not required to
be returned within a tuple. Here is an example: return
a
.
Therefore, it could
be return a,b,c or return (a,b,c)
.
Note: Order does matter. Therefore,
the order in the return statement must match the order in the "Output:"
line. A best practice is to cut and paste from one to the other.