Ok firstly, this idea was inspired specifically by a project I'm working on for
school concerning linked lists, in which I was trying to create a method that
performed a function on elements iteratively without having to navigate the
list from the head each time (of course taking the function as
Thanks Antoon. I do suppose that it is kind of wrong to say the only way is to
"reference its [the function's] name" as an argument, however the point I was
trying to make was that it isn't possible to pass a function that is either not
in some way previously defined or a reference to something
Thanks Antoon. I do suppose that it is kind of wrong to say the only way is to
"reference its [the function's] name" as an argument, however the point I was
trying to make was that you cannot pass a function that is either not in some
way previously defined or a reference to something previously
Hi, I'm new to the group and to Python, so forgive me if I make any faux-pas
here. As I can tell, the only way to pass a function as an argument is to
reference its name as follows:
def foo1(message):
print(message)
def foo2(foo, message):
print("Your function says:")
foo(message)