A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/073308.html below:

function pointers

function pointers function pointersMax Møller Rasmussen maxm at normik.dk
Thu Apr 26 05:55:38 EDT 2001
> From: Brandon J. Van Every [mailto:vanevery at 3DProgrammer.com]

> I get the feeling that Python doesn't have anything 
> resembling a function
> pointer?  i.e. no way to call a specific function according 
> to the value a
> variable is set to?

Might this be what you are looking for?

def hello():
	return 'hello'

def world():
    return 'world'

functions = {}
functions['hll'] = hello
functions['wrld'] = world

print functions['hll']()
print functions['wrld']()

regards Max M


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4