it's like math with parenthesis... if b == 1: import a
will trigger "import a" when b == 1 . the first time b==1 it'd be a real import, the second time it'd be a no-op if b is never going to be == 1, import will be never triggered. On Friday, April 29, 2016 at 3:32:05 PM UTC+2, Mark Billion wrote: > > Right, but if the import is a conditional one -- ie, only import a if a > condition evals to true -- does it no op the import if the condition goes > to false or does it import all and then execute? > > On Friday, April 29, 2016 at 3:23:40 AM UTC-4, Niphlod wrote: >> >> in python if you have >> >> >> import a >> blablabla >> import b >> blablabla >> import a >> >> the second "import a" statement is executed, but is a no-op. >> >> On Friday, April 29, 2016 at 1:20:59 AM UTC+2, Mark Billion wrote: >>> >>> I understand that the whole default.py file is executed on each request >>> to a function internal to it. But does it import if the statement evaluates >>> to false? >>> >>> For example if default.py has: >>> >>> Function x(): >>> If 1==2: >>> Import a >>> >>> Does a get imported every time function x is called? >>> >>> -- 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.