Brandon J. Van Every <vanevery at 3DProgrammer.com> wrote in comp.lang.python: > Please pardon my ignorant questions. I'm just trying to grok Python > efficiently as a complete beginner, without having to search endlessly in > every page of TFM. > > 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? In fact, I get the feeling it doesn't have pointers of > any sort at all? It's the other way around. *Everything* is a pointer. def whee(x): print "My argument was:", x 'whee' is now a reference (pointer) to the function we just created. We can pass it to itself, for instance: >>> whee(whee) My argument was: <function whee at 8071750> Every variable is just a reference to an object somewhere. And functions are just objects, just like lists, integers, and everything. -- Remco Gerlich
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