function pointer

Gerhard Häring gerhard.haering at opus-gmbh.net
Wed Sep 11 06:23:22 EDT 2002


Christina wrote:
> Does Python have function pointers? [...]

Functions, as well as modules, classes and about everything else are
objects in Python. Python doesn't have pointers, but it does have
references, so you can make a reference to a function like this:

def foo():  pass

# Create a reference to the 'foo' function:
bar = foo

Python is highly dynamic, so this is nothing special. You can make
references to functions, classes and even modules. You can dynamically
create functions and classes at runtime, and a lot more.

Servus,

Gerhard



More information about the Python-list mailing list