[Numpy-discussion] simple python question on what happens when functions are declared

Frank Lagor dfranci at seas.upenn.edu
Wed Nov 19 18:30:08 EST 2008


Hi,

Can someone please explain what happens here:

In testfile.py:

x = 5
def arbFunc():
    print x
    del x
    print "Done with Test"
arbFunc()

Then run the file with python testfile.py

As opposed to
x = 5
print x
del x
print "Done with Test"

Which of course works fine. This question is of importance to me,
because I may may very large arrays that strain the limits of the
machine's memory and I need to clean up after myself when I generate
other large objects temporarily.


Thanks in advance!
Frank



More information about the NumPy-Discussion mailing list