thanks again for all the help! especially the advice on ideas of
tracking down the memory leak :). (sorry for not mentioning it
earlier...i had thought deleting everything might be a quick and dirty
way short-term fix. :P)
best,
-Johnny
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
(OTOH, deletions of actual local bindings do seem to propagate back into a
previously
bound value of locals on exit, and a new call to locals() seems to return the
same identical
object as before, so I'm not sure I believe the , unless it has a
special slot
and it is automat
On 21 Jan 2005 11:13:20 -0800, "Johnny Lin" <[EMAIL PROTECTED]> wrote:
>thanks everyone for the replies!
>
>John Hunter, yep, this is Johnny Lin in geosci :).
>
>re using return: the problem i have is somewhere in my code there's a
>memory leak. i realize return is supposed to unbind all the loc
Alex Martelli wrote:
Nevertheless, any modifications to locals() are utterly
futile (within a function).
Evil hack that makes modifications to locals() not quite as futile:
py> import sys
py> import ctypes
py> def f():
... x = 1
... locals()['x'] = 2
... ctypes.pythonapi.PyFrame_LocalsT
Johnny Lin <[EMAIL PROTECTED]> wrote:
...
> my understanding about locals() from the nutshell book was that i
> should treat that dictionary as read-only. is it safe to use it to
> delete entries?
Speaking as the Nutshell author: it's "safe", it just doesn't DO
anything. I _hoped_ locals() wo
Johnny Lin wrote:
my understanding about locals() from the nutshell book was that i
should treat that dictionary as read-only. is it safe to use it to
delete entries?
No it's not:
py> def f():
... x = 1
... del locals()['x']
... print x
...
py> f()
1
py> def f():
... x = 1
...
thanks everyone for the replies!
John Hunter, yep, this is Johnny Lin in geosci :).
re using return: the problem i have is somewhere in my code there's a
memory leak. i realize return is supposed to unbind all the local
variables, but since the memory leak is happening despite return, i
thought
John Hunter wrote:
>>>del locals()['x']
The locals() dictionary will only modify values in a module's top-level
code (i.e. when the expression "locals() is globals()" is true).
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
Is there a way to automate the unbinding of multiple variables? Say I
have a list of the names of all variables in the current scope via
dir(). Is there a command using del or something like that that will
iterate the list and unbind each of the variables?
Thanks much! (If anyone posts an
Johnny Lin wrote:
> Hi!
>
> Is there a way to automate the unbinding of multiple variables? Say
I
> have a list of the names of all variables in the current scope via
> dir(). Is there a command using del or something like that that will
> iterate the list and unbind each of the variables?
Yes.
> "Johnny" == Johnny Lin <[EMAIL PROTECTED]> writes:
Johnny> Hi! Is there a way to automate the unbinding of multiple
Johnny> variables? Say I have a list of the names of all
Johnny> variables in the current scope via dir(). Is there a
Johnny> command using del or something
On 20 Jan 2005 19:24:43 -0800, Johnny Lin <[EMAIL PROTECTED]> wrote:
> Hi!
>
> Is there a way to automate the unbinding of multiple variables? Say I
> have a list of the names of all variables in the current scope via
> dir(). Is there a command using del or something like that that will
> itera
12 matches
Mail list logo