Lifetime of a local reference
Gregory Ewing
greg.ewing at canterbury.ac.nz
Fri Mar 1 19:32:53 EST 2019
Alan Bawden wrote:
> The Java compiler has no way to know whether a variable references an
> object with a finalize() method that has side effects
It should be able to tell in some situations, e.g.
String a = "hello";
String b = a.replace('e', 'u');
There's no way that b can reference anything other than a
plain String instance at this point.
Maybe Java implementations are living dangerously and making
assumptions beyond this. My point is that I would expect a
Python implementation to be careful enough not to get this
wrong.
--
Greg
More information about the Python-list
mailing list