As an interpretative scripting language, there is essentially no reflection at all. Because any string can be interpreted as code.
There are eval in Perl, which is also in Python, but is subdivided into eval and exec.
This can be regarded as the ultimate reflex killing device, due to the power is too great, python3 in the grammar of some restrictions.
Allows exec to import into local variable space instead of global space.
A step closer than the loading of the module, we can put a portion of the code, or the rules, templates, stored in a remote centralized server or configuration center, and then dynamically load through eval. This eliminates the hassle of distributing code to different machines.
In extreme cases, the executing server can only run a common framework, and core code is all fetched and injected from the central server. This is a bit like Erlang's gensvr idea.
Str= '
def dev_r_ci_iox_cpu (): "" "
dev_r_ci_iox_cpu" "
oids=". 1.3.6.1.2.1.1.1.0 "
ret=_ Httpsnmpget (OIDs) return
ret
t=dev_r_ci_iox_cpu
' '
#str =rpc.getfile (FID)
_locals = locals ()
exec (Str,globals (), _locals) #用局部变量来注入
f=_locals[' t '] #模板中的函数名只有核对意义.