[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread David W. Lambert
David W. Lambert added the comment: #Ah! Not a problem. You need globals() and locals() dictionaries. # as a python3 script, this message produces next couple lines output. #method one #yup, global a is gone #method two #{'gv': 'local here', 'name': 'gv'} #yup, global gv is gone print('metho

[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread Martin v. Löwis
Martin v. Löwis added the comment: > Another way of resolving the problem would be making it impossible to > make a local variable when there is anothe one with the same name. Please trust that there really is no problem. If you don't understand how Python works, ask on a mailing list. If you

[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread Jerzy
Jerzy added the comment: I am not an expert. But for me it is much better. If you cannot delete the global variable in a function (del makes the variable local anyway). So trying to delete a global variable should raise an exception "Cannot delete a global variable" or something like that. In

[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread David W. Lambert
David W. Lambert added the comment: The alternative is unreasonable. I doubt you'd be happy with this: a = 'Something' def variable_both_global_and_local()->Exception('No good!'): del a# delete a from global name space a = 'anotherthing' # define a in local name space _

[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread Jerzy
Jerzy added the comment: And anyway, for me it's not OK if something in a code of a function like 'del' affect how variables are affected in whole function. It is really illogical. There code is in lines and line are one below another. The logical way is that a line of code affects the progra

[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread Jerzy
Jerzy added the comment: OK, I see and if don't want l to exist in f() I have to: def f(): pass def a(): l=[] f() a() Jurek Martin v. Löwis wrote: > Martin v. Löwis added the comment: > >> I still do not understand what is going on when python executed thic >> code. I have

[issue5092] weird memory usage in multiprocessing module

2009-01-29 Thread Martin v. Löwis
Martin v. Löwis added the comment: > I still do not understand what is going on when python executed thic > code. I have a local variable l in my parent process. No, you don't. It's a global variable, not a local one. > When I create a > child process, program makes first makes a copy of me

[issue5092] weird memory usage in multiprocessing module

2009-01-29 Thread Jerzy
Jerzy added the comment: I still do not understand what is going on when python executed thic code. I have a local variable l in my parent process. When I create a child process, program makes first makes a copy of memory. Than what? I am sure that l still exists in child process because 1. I

[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread Martin v. Löwis
Martin v. Löwis added the comment: As David says, this is not a bug. del l indicates that there is a local variable to be deleled, but when the del statement is executed, there is no local variable. The error message is confusing in this case: there actually is no later assignment to l (in the f

[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread David W. Lambert
David W. Lambert added the comment: My second answer is irrelevant. Function receives the global data as well as the arguments. ___ Python tracker ___ __

[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread David W. Lambert
David W. Lambert added the comment: The del statement makes the variable local, as alluded to by http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-del- statement The manual is clearer about assignments, which are local unless declared global or nonlocal. For other question, me

[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread Jerzy
New submission from Jerzy : Hi I am using the multiprocessing mudule and I found a very weird thing. It seems that that the result of one fragment of the code depends on the fragment of the code that is after it, which should not happen. My script looks like this import time import multiproce