Using python in interactive mode, one imports the module, and then if the module is changed (fixing a bug or something else), you can simply use the reload () command.
But what if I did not import the entire module and use the import statement from m import f, g. Is there a way to reimport only g?
(I tried to remove the function from the parameter table using 'del g' and delete the .pyc file from the directory. That did not help. When I re-imported the function 'from M import g', the old g was loaded).
from foo import bar, . bar . .
from foo import bar
bar
reload (, C). .
reload
, , - :
def my_reload(mod, name): reload(mod) globals()[name] = getattr(mod, name) myreload(somemodule, "some_function")
. , , , , . , reload . , , , __name__. , __name__, - , .
__name__
, , , reload, . , .
( ):
import numpy as NP import numpy.linalg as LA ... reload(LA)
Source: https://habr.com/ru/post/1779143/More articles:Android Eclipse ADT 8.0.0 (and 8.0.1) problem - it is not possible to create a hierarchy of drag and drop views in the Structure view - androidHow to connect Java to Mysql? - javaJSF2 compound expression cc.attrs does not correctly evaluate action parameters - elhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1779141/cannot-pass-arguments-to-a-method-through-el-javaxelmethodnotfoundexception&usg=ALkJrhiAanuhQVeDSHmYD4OjZKSLY8seyQHow to get excellent result from specs + scalacheck with maven? - scalaShould I use an iterator to create a loop over a HashMap? - javaWhy is there maximum heap tuning in Java? - javaThe ubiquitous keyboard shortcut to search Next in Eclipse? - eclipseStrange behavior between foreach and loop - c #Продолжает ли поток работать, когда тайм-ауты Future.get(timeout) - javaAll Articles