Can global variable be passed into Python function?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Feb 23 01:39:36 CET 2014


On Sat, 22 Feb 2014 13:03:33 -0500, Dennis Lee Bieber wrote:

> As I recall, to handle garbage collection, Apple used to use two stage
> look ups... The user variable (handle) was a reference into a table of
> handles, and each entry in that table was a reference to the real object
> out in memory. Garbage collection would move the objects around to
> compact used memory, updating the address in the table -- the user
> program never sees the object moving as its handle address never
> changed.

Yes, but that was not transparent to the user. You actually had to 
explicitly use the Mac Toolbox memory routines to allocate memory, create 
and destroy handles, etc.

If you just used your programming language's normal pointers, they 
couldn't and wouldn't move.



-- 
Steven



More information about the Python-list mailing list