Deprecating reload() ???

David MacQuigg dmq at
Fri Mar 12 20:35:10 CET 2004

On Fri, 12 Mar 2004 18:48:35 +0300 (MSK), "Denis S. Otkidach"
<ods at> wrote:

>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

I'm not sure what you are intending with this code, but I'll assume
'new_value' is the object to be updated with a reload.  'adict' and
'atuple' should retain their references to the old object, since
dictionary keys and tuples are immutable.  'module.var' and 'someobj'
no longer point to 'new_value', so they can be left as is.

If the reload were done *before* the last two lines, then 'module.var'
and 'someobj' should be changed to point to the new 'new_value'.

-- Dave

More information about the Python-list mailing list