>From http://web2py.com/book/default/chapter/04#Dispatching :

"Functions that take arguments or start with a double underscore are
not publicly exposed and can only be called by other functions."

So, as long as a function takes at least one argument, it will be
private, even without the double underscore. E.g.,

def private_function(any_argument):


On Oct 24, 1:21 pm, JimK <jkel...@gmail.com> wrote:
> You can leave the function in the controller file but pre-pend __ to
> the name.  This is the Python way to create private functions and it
> appears to be supported well in Web2Py.
>
> An example would be:
>
> def __privateFunc():
>
> On Oct 24, 5:18 am, Luther Goh Lu Feng <elf...@yahoo.com> wrote:
>
>
>
> > If I have a function that I intend to call from different controllers, but I
> > have no need for the function to have a view, where should this function be
> > defined? eg. a function that simply calculates the outcome of a math 
> > formula,
> > and several controllers will call this function to display the result.
>
> > Should it be defined within a controller, or elsewhere?- Hide quoted text -
>
> - Show quoted text -

Reply via email to