Deprecating reload() ???

Denis S. Otkidach ods at strana.ru
Fri Mar 12 16:48:35 CET 2004


On Fri, 12 Mar 2004, Skip Montanaro wrote:

SM> Given Python's current object model it would be an
SM> interesting challenge to
SM> write a "super reload" which could identify all the objects
SM> created as a
SM> side effect of importing a module and for those with
SM> multiple references,
SM> locate those other references by traversing the known object
SM> spaces, then
SM> perform the import and finally rebind the references found
SM> in the first
SM> step.  I thought I saw something like this posted in a
SM> previous thread on
SM> this subject.

Is it possible?  How to handle the following cases:

module.var = new_value
adict = {module.var: value}
atuple = (module.var,)

module.var = someobj = new_value  # now they refer to the same
                                  # object

module.var = 0 # 0, 1 etc. are always shared. We cannot test
someobj = 0    # where it came from

-- 
Denis S. Otkidach
http://www.python.ru/      [ru]





More information about the Python-list mailing list