[issue5092] weird memory usage in multiprocessing module

Jerzy report at bugs.python.org
Fri Jan 30 23:52:31 CET 2009


Jerzy <jerzyo at genesilico.pl> 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 a function variable should be global till the place when you 
define a local one.

Example:

a='Something'

def f():
  print a   #prints the global variable a
  del a     #Make an exception that a is global so it cannot be deleted
  a='anotherthing' #make a local a
  print a  #print local a
  del a    #delete local a
  print a  #print global a

f()

Also, if there are two variable (global and local) with seme name, there 
should be a way to access either of them like 'print loc(a)' and 'print 
glob(a)'. This is just a suggestion

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.

David W. Lambert pisze:
> David W. Lambert <lambertdw at corning.com> 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
> 
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue5092>
> _______________________________________
> 
> 
>

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5092>
_______________________________________


More information about the Python-bugs-list mailing list