Deprecating reload() ???
David MacQuigg
dmq at gain.com
Mon Mar 15 11:27:12 EST 2004
On Sun, 14 Mar 2004 19:49:08 -0500, "John Roth"
<newsgroups at jhrothjr.com> wrote:
>"David MacQuigg" <dmq at gain.com> wrote in message
>news:rhj950ts4fbrbfadp0s5fmp3vn6bhh7ppc at 4ax.com...
>>
>> I *would* like to do something about numbers and strings and other
>> shared objects not getting updated, because that is going to be hard
>> to explain. Maybe we could somehow switch off the generation of
>> shared objects for modules in a 'debug' mode.
>
>It doesn't matter if numbers and strings get updated. They're
>immutable objects, so one copy of a number is as good as
>another. In fact, that poses a bit of a problem since quite
>a few of them are singletons. There's only one object that
>is an integer 1 in the system, so if the new version changes
>it to, say 2, and you go around and rebind all references to
>1 to become references to 2, you might have a real mess
>on your hands.
The immutability of numbers and strings is referring only to what you
can do via executable statements. If you use a text editor on the
original source code, clearly you can change any "immutable".
You do raise a good point, however, about the need to avoid changing
*all* references to a shared object. The ones that need to change are
those that were created via a reference to an earlier version of the
reloaded module.
>On the other hand, if you don't rebind the ones that came out
>of the original version of the module, you've got a different
>mess on your hands.
True.
-- Dave
More information about the Python-list
mailing list