Question About When Objects Are Destroyed

Jon Forrest nobozo at gmail.com
Fri Aug 4 19:42:56 EDT 2017


On 8/4/2017 4:34 PM, gst wrote:
> 'two' is a so called constant or literal value .. (of that
> function).
> 
> Why not attach it, as a const value/object, to the function itself ?
> So that a new string object has not to be created each time the
> function is called. Because anyway strings are immutable. So what
> would be the point to recreate such object every time the function is
> called ?

This was just an example program, not meant to do anything
meaningful. I would think that the same object behavior would
occur if I dynamically created an object in that function.

Jon







More information about the Python-list mailing list