pointer in Python

William Park opengeometry at yahoo.ca
Wed Mar 5 13:25:20 EST 2003


Roy Marteen <rm at no-mail.com> wrote:
> Hi,
> 
> Can I parse a variable using a pointer in Python? And how can I
> declare pointer to function in Python? Thank you very much.

Actually, everything in Python is "pointer to something real".  This is
called "object reference" in Python.  So, you can assign function to a
variable, and that variable will be a pointer to that function, ie.
    def func(a):
	return a + 1
    print func(5)
    f = func
    print f(5)

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
Linux solution for data management and processing. 




More information about the Python-list mailing list