Re: When (and why) to use del?

2008-12-10 Thread Gabriel Genellina
En Tue, 09 Dec 2008 15:29:17 -0200, Philip Semanchuk [EMAIL PROTECTED] escribió: On Dec 9, 2008, at 11:35 AM, Albert Hopkins wrote: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string

Re: When (and why) to use del?

2008-12-10 Thread Philip Semanchuk
On Dec 10, 2008, at 5:23 PM, Gabriel Genellina wrote: En Tue, 09 Dec 2008 15:29:17 -0200, Philip Semanchuk [EMAIL PROTECTED] escribió: On Dec 9, 2008, at 11:35 AM, Albert Hopkins wrote: def myfunction(): # do some stuff stuff my_string =

When (and why) to use del?

2008-12-09 Thread Albert Hopkins
I'm looking at a person's code and I see a lot of stuff like this: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string del my_string # do some other stuff

Re: When (and why) to use del?

2008-12-09 Thread Slaunger
On 9 Dec., 17:35, Albert Hopkins [EMAIL PROTECTED] wrote: I'm looking at a person's code and I see a lot of stuff like this:         def myfunction():             # do some stuff stuff             my_string = function_that_returns_string()             # do some stuff with my_string          

Re: When (and why) to use del?

2008-12-09 Thread malkarouri
On 9 Dec, 16:35, Albert Hopkins [EMAIL PROTECTED] wrote: I'm looking at a person's code and I see a lot of stuff like this:         def myfunction():             # do some stuff stuff             my_string = function_that_returns_string()             # do some stuff with my_string          

Re: When (and why) to use del?

2008-12-09 Thread pruebauno
On Dec 9, 11:35 am, Albert Hopkins [EMAIL PROTECTED] wrote: I'm looking at a person's code and I see a lot of stuff like this:         def myfunction():             # do some stuff stuff             my_string = function_that_returns_string()             # do some stuff with my_string        

Re: When (and why) to use del?

2008-12-09 Thread Philip Semanchuk
On Dec 9, 2008, at 11:35 AM, Albert Hopkins wrote: I'm looking at a person's code and I see a lot of stuff like this: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string del

Re: When (and why) to use del?

2008-12-09 Thread Duncan Booth
Albert Hopkins [EMAIL PROTECTED] wrote: def otherfunction(): try: # some stuff except SomeException, e: # more stuff del e return I think this looks ugly, but also does it not hurt performance

Re: When (and why) to use del?

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 18:55, Duncan Booth wrote: Albert Hopkins [EMAIL PROTECTED] wrote: def otherfunction(): try: # some stuff except SomeException, e: # more stuff del e return I think this looks

Re: When (and why) to use del?

2008-12-09 Thread Bruno Desthuilliers
malkarouri a écrit : (snip) The del statement doesn't actually free memory. It just removes the binding from the corresponding namespace. So in your first example, my_string cannot be used after the deletion. Of course, if the string referenced by my_string was referenced by some other name