An Example Function

Before you can understand decorators, you must first understand how functions work. This lesson covers

  • What functions are
  • What goes into functions
  • How functions can be used as arguments for other functions

Comments & Discussion

Peter T on March 22, 2019

You created “def my_function():” but then you called my_func(), but you should have called my_function(), since my_func() will call another function “def my_funct():” which wasn’t defined yet. This might be confusing to a beginner. I hope this is clear to everyone. Great course so far!

Peter T on March 22, 2019

Arguments are used in between the parenthesis in the “def” header {e.g. def my_function(arg1, arg2)}, but Parameters are used in between the parenthesis when calling the function {e.g. my_function(param1, param2)}.

Chris Bailey RP Team on March 22, 2019

Thanks for the comments Peter! I had noticed the error in the slide when we released the video, and Dan put up the fixed version, calling the correct my_function(). It somehow reverted back, but should be fixed again.

On the arguments vs parameters, I do see a mix of both used when explaining them, example here on python.org: docs.python.org/3/tutorial/controlflow.html#defining-functions

I agree that the use case you have is solid.

Anonymous on April 5, 2019

Great tutorial. What is the name of the Terminal you use.

Chris Bailey RP Team on April 9, 2019

Thanks so much! I’m using Bpython as a REPL (Read, Eval, Print, Loop) tool inside of Visual Studio Code.

Become a Member to join the conversation.