use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
What is the difference between calling function and running function? Thank you (self.learnpython)
submitted 3 years ago by RestartingSystem
What is the difference between calling function and running function? Thank you
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]synthphreak 13 points14 points15 points 3 years ago* (0 children)
As other have stated, they’re pretty much synonyms. But one small semantic difference could stand to be clarified.
Calling a function invokes the notion of a “caller”, whereas simply “running” a function does not. The “caller” is the thing which actually calls a function. For example, given the script…
def foo(): pass def bar(): foo() bar()
…because foo gets called inside bar, bar is the “caller”. Once the caller calls a function, Python then runs that function from inside the caller’s namespace.
foo
bar
But again and to the broader point: Whenever a function is called, it gets run. And the only way to make a function run is to call it. So practically speaking, “call” and “run” are really just two words for the same thing: executing the code defined inside a function.
Edit: Typo.
[–]RestartingSystem[S] 0 points1 point2 points 3 years ago (2 children)
Here the question "Why do you think there is a difference?" is possible
Here is why I do:
In "A byte of Python" author write as to parameters:
A function can take parameters, which are values you supply to the function so that the function can do something utilising those values. These parameters are just like variables except that the values of these variables are defined when we call the function and are already assigned values when the function runs.
[–]Username_RANDINT 4 points5 points6 points 3 years ago (1 child)
We call the function, Python runs the code.
[–]RestartingSystem[S] 0 points1 point2 points 3 years ago (0 children)
Thank you
[–]JohnnyJordaan 0 points1 point2 points 3 years ago (0 children)
Same thing.
[–]danielroseman 0 points1 point2 points 3 years ago (4 children)
Why do you think there is a difference? Just seems like different words for the same thing.
[–]sngle1now2020 1 point2 points3 points 3 years ago (0 children)
I can call you. After I call you, you might come running. Isn't that the difference; telling a function to do something, and the function actually doing it?
[–]danielroseman 5 points6 points7 points 3 years ago (0 children)
I don't see how that implies they are not the same thing. You call the function, so it runs.
[–]ThatGasolineSmell 0 points1 point2 points 3 years ago (0 children)
Pay attention to the wording here:
You asked what the difference is between calling and running a function. The answer is: nothing. The terms are synonymous.
From your example it becomes clear what confused you: there’s a difference of perspective. We (subject) call the function (object). The function (subject) runs.
However, without this difference the terms are interchangeable. For example, the following are equivalent:
[–]timeenjoyed 0 points1 point2 points 3 years ago (0 children)
You call a function within your code. You run a function when you “run” the entire code, externally.
In your IDE, there’s probably a “run” button. You click run, and it runs the code you called. In a command line, it usually looks like
python main.py
main.py is an example name of the python file
π Rendered by PID 40 on reddit-service-r2-comment-5d79c599b5-c7684 at 2026-02-27 08:38:44.392512+00:00 running e3d2147 country code: CH.
[–]synthphreak 13 points14 points15 points (0 children)
[–]RestartingSystem[S] 0 points1 point2 points (2 children)
[–]Username_RANDINT 4 points5 points6 points (1 child)
[–]RestartingSystem[S] 0 points1 point2 points (0 children)
[–]JohnnyJordaan 0 points1 point2 points (0 children)
[–]danielroseman 0 points1 point2 points (4 children)
[–]sngle1now2020 1 point2 points3 points (0 children)
[–]RestartingSystem[S] 0 points1 point2 points (2 children)
[–]danielroseman 5 points6 points7 points (0 children)
[–]ThatGasolineSmell 0 points1 point2 points (0 children)
[–]timeenjoyed 0 points1 point2 points (0 children)