On Tuesday, May 12, 2015 at 10:07:03 AM UTC-7, KevC wrote:
>
> Hi community!
>
> I want to call a function inside other function, What can I do?
>
>
> For example:
> def function_1():
>     y = 'This is an example'
>     (I wanna here my function "function_2")
>     return locals()
>
> def function_2():
>     x = 'Hello world'
>     return locals()
>
>
> My best regards
>

Like Derek says, you just call it.  I did that to wrap a webpage (and form) 
around a call to a function_2() that has an @service decorator
(it's a SOAP provider for the normal clients, but I wanted to get the 
response in a browser as well).

I also have controllers that would be unreadable if I didn't split pieces 
out into supporting routines.  Since these aren't meant to be directly 
visible, they all have parameters (and most of them need the parameters); 
Web2Py will not expose functions with parameters.

I don't think I've done controllers with nested procedures (also mentioned 
by Derek), but it is a common enough Python technique.

/dps


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to