F
Farshid Lashkari
When I pass an empty string to a function is a new string object created
or does python use some global pre-created object? I know python does
this with integer objects under a certain value. For instance, in the
following code is a new string object created for each function call?
func(0,'')
func(1,'')
func(2,'')
func(3,'')
I tried the following commands in the interactive shell:
True
This leads me to believe that python does reuse existing strings, but
once the variables are removed, does the item still exist in the cache?
-Farshid
or does python use some global pre-created object? I know python does
this with integer objects under a certain value. For instance, in the
following code is a new string object created for each function call?
func(0,'')
func(1,'')
func(2,'')
func(3,'')
I tried the following commands in the interactive shell:
True
This leads me to believe that python does reuse existing strings, but
once the variables are removed, does the item still exist in the cache?
-Farshid