python namespace hierarchy above object -
For example, if this code is included in some modules then
class C: Class C2: DRF g (self): @ print namespaceboughdeff (): pass
then the print name page above will be defined so that this code is some such output
[Some_module, C, C2, g]
doing this There is no way of code, as presented, there is no output - the body of G (in which deco With the rator you want to print) just does not does not unless it is called live. I believe that you really do not intend to produce anything of yourself for "this code", but rather intend to add a call like CC 2 () [which will actually output].
There is really no very effective way to do this - you should start (well, the decorator ;-) at the module level (which you can call globals of f
You can identify through the decorator's logic: its name is f.func_globals ['__name__']
and through its name you can call it sys.modules
), You should walk down to every possible series, as long as you have your calling function (like in the standard library Shall determine) via modules. Also keep in mind that nested functions have a special headache in many corner cases.
Comments
Post a Comment