The other answers have done a good job at explaining duck typing and the simple answer by tzot:

Python does not have variables, like other languages where variables have a type and a value; it has names pointing to objects, which know their type.

However, one interesting thing has changed since 2010 (when the question was first asked), namely the implementation of PEP 3107 (implemented in Python 3). You can now actually specify the type of a parameter and the type of the return type of a function like this:

def pick(l: list, index: int) -> int:
    return l[index]

Here we can see that pick takes 2 parameters, a list l and an integer index. It should also return an integer.

So here it is implied that l is a list of integers which we can see without much effort, but for more complex functions it can be a bit confusing as to what the list should contain. We also want the default value of index to be 0. To solve this you may choose to write pick like this instead:

def pick(l: "list of ints", index: int = 0) -> int:
    return l[index]

Note that we now put in a string as the type of l, which is syntactically allowed, but it is not good for parsing programmatically (which we'll come back to later).

It is important to note that Python won't raise a TypeError if you pass a float into index, the reason for this is one of the main points in Python's design philosophy: "We're all consenting adults here", which means you are expected to be aware of what you can pass to a function and what you can't. If you really want to write code that throws TypeErrors you can use the isinstance function to check that the passed argument is of the proper type or a subclass of it like this:

def pick(l: list, index: int = 0) -> int:
    if not isinstance(l, list):
        raise TypeError
    return l[index]

More on why you should rarely do this and what you should do instead is talked about in the next section and in the comments.

PEP 3107 does not only improve code readability but also has several fitting use cases which you can read about here.


Type annotation got a lot more attention in Python 3.5 with the introduction of PEP 484 which introduces a standard module typing for type hints.

These type hints came from the type checker mypy (GitHub), which is now PEP 484 compliant.

The typing module comes with a pretty comprehensive collection of type hints, including:

  • List, Tuple, Set, Dict - for list, tuple, set and dict respectively.
  • Iterable - useful for generators.
  • Any - when it could be anything.
  • Union - when it could be anything within a specified set of types, as opposed to Any.
  • Optional - when it might be None. Shorthand for Union[T, None].
  • TypeVar - used with generics.
  • Callable - used primarily for functions, but could be used for other callables.

These are the most common type hints. A complete listing can be found in the documentation for the typing module.

Here is the old example using the annotation methods introduced in the typing module:

from typing import List

def pick(l: List[int], index: int) -> int:
    return l[index]

One powerful feature is the Callable which allows you to type annotate methods that take a function as an argument. For example:

from typing import Callable, Any, Iterable

def imap(f: Callable[[Any], Any], l: Iterable[Any]) -> List[Any]:
    """An immediate version of map, don't pass it any infinite iterables!"""
    return list(map(f, l))

The above example could become more precise with the usage of TypeVar instead of Any, but this has been left as an exercise to the reader since I believe I've already filled my answer with too much information about the wonderful new features enabled by type hinting.


Previously when one documented Python code with for example Sphinx some of the above functionality could be obtained by writing docstrings formatted like this:

def pick(l, index):
    """
    :param l: list of integers
    :type l: list
    :param index: index at which to pick an integer from *l*
    :type index: int
    :returns: integer at *index* in *l*
    :rtype: int
    """
    return l[index]

As you can see, this takes a number of extra lines (the exact number depends on how explicit you want to be and how you format your docstring). But it should now be clear to you how PEP 3107 provides an alternative that is in many (all?) ways superior. This is especially true in combination with PEP 484 which, as we have seen, provides a standard module that defines a syntax for these type hints/annotations that can be used in such a way that it is unambiguous and precise yet flexible, making for a powerful combination.

In my personal opinion, this is one of the greatest features in Python ever. I can't wait for people to start harnessing the power of it. Sorry for the long answer, but this is what happens when I get excited.


An example of Python code which heavily uses type hinting can be found here.

Answer from erb on Stack Overflow
🌐
Python Basics
python-basics-tutorial.readthedocs.io › en › latest › functions › params.html
Parameters - Python Basics
October 27, 2025 - If no return statement is found, the value None is returned by Python. ... Function arguments can be entered either by position or by name (keyword). z and y are specified by name in our example. ... Function parameters can be defined with default values that will be used if a function call ...
🌐
Runestone Academy
runestone.academy › ns › books › published › fopp › Functions › FunctionParameters.html
12.4. Function Parameters — Foundations of Python Programming
When a function has one or more parameters, the names of the parameters appear in the function definition, and the values to assign to those parameters appear inside the parentheses of the function invocation.
Discussions

Difference between parameters and arguments in python
Parameters are part of a function definition, they are the names given to arguments inside the function. Arguments are the values you call a function with. def say_hello(name): // ... say_hello("shadow_swamper") name is a parameter of function say_hello, its first parameter. "shadow_swamper" is the argument we pass to the say_hello function. More on reddit.com
🌐 r/learnprogramming
24
3
September 5, 2025
Please help me understand functions and parameters..
So, taking a swing at it....the parameter(s) in Python are just a way of telling the function that it should be receiving one or more objects/pieces of information. How you write the function determines what type of object those things need to be. Per your example, def funct(param): print(param) Can be used with any type of object that can be printed out to the console; like: func(23) func("Hello, Timmy") will print out the value 23, and then the string "Hello, Timmy" What this, also, means is that you can assign things to variables and pass those variables in to the parameter spot (referred to as an argument when calling the function) and they will still be the object/type of object that you assigned earlier. a = [2, 5, 7, 9] func(a) will print [2, 5, 7, 9] out to the console. Does that help? More on reddit.com
🌐 r/learnpython
26
4
February 3, 2023
🌐
Medium
medium.com › @gauravverma.career › parameters-arguments-in-python-function-74a057662c0e
Parameters/Arguments in python function | by Gaurav Verma | Medium
December 7, 2025 - For more details, please refer “user defined functions in python” · ##Function without parameter and no return value def func_without_params_and_return_value(): print("this function does not have parameters") print("this function does not have return value") ##function with two parameter and no return value def my_function(firstname, lastname): print(firstname) print(lastname)
🌐
Python Course
python-course.eu › python-tutorial › passing-arguments.php
25. Passing Arguments | Python Tutorial | python-course.eu
November 8, 2023 - Correctly speaking, Python uses a mechanism, which is known as "Call-by-Object", sometimes also called "Call by Object Reference" or "Call by Sharing". If you pass immutable arguments like integers, strings or tuples to a function, the passing acts like call-by-value. The object reference is passed to the function parameters.
🌐
Mimo
mimo.org › glossary › python › parameter
Python Parameters: Essential Coding Know-How | Learn Now
Python parameters allow functions to receive values from a function call. Within the function, parameters become available as variables. Parameters can be of any type, including integers, floats, strings, lists, dictionaries, and even functions.
🌐
W3Schools
w3schools.com › python › python_arguments.asp
Python Function Arguments
A parameter is the variable listed inside the parentheses in the function definition.
Find elsewhere
Top answer
1 of 14
1151

The other answers have done a good job at explaining duck typing and the simple answer by tzot:

Python does not have variables, like other languages where variables have a type and a value; it has names pointing to objects, which know their type.

However, one interesting thing has changed since 2010 (when the question was first asked), namely the implementation of PEP 3107 (implemented in Python 3). You can now actually specify the type of a parameter and the type of the return type of a function like this:

def pick(l: list, index: int) -> int:
    return l[index]

Here we can see that pick takes 2 parameters, a list l and an integer index. It should also return an integer.

So here it is implied that l is a list of integers which we can see without much effort, but for more complex functions it can be a bit confusing as to what the list should contain. We also want the default value of index to be 0. To solve this you may choose to write pick like this instead:

def pick(l: "list of ints", index: int = 0) -> int:
    return l[index]

Note that we now put in a string as the type of l, which is syntactically allowed, but it is not good for parsing programmatically (which we'll come back to later).

It is important to note that Python won't raise a TypeError if you pass a float into index, the reason for this is one of the main points in Python's design philosophy: "We're all consenting adults here", which means you are expected to be aware of what you can pass to a function and what you can't. If you really want to write code that throws TypeErrors you can use the isinstance function to check that the passed argument is of the proper type or a subclass of it like this:

def pick(l: list, index: int = 0) -> int:
    if not isinstance(l, list):
        raise TypeError
    return l[index]

More on why you should rarely do this and what you should do instead is talked about in the next section and in the comments.

PEP 3107 does not only improve code readability but also has several fitting use cases which you can read about here.


Type annotation got a lot more attention in Python 3.5 with the introduction of PEP 484 which introduces a standard module typing for type hints.

These type hints came from the type checker mypy (GitHub), which is now PEP 484 compliant.

The typing module comes with a pretty comprehensive collection of type hints, including:

  • List, Tuple, Set, Dict - for list, tuple, set and dict respectively.
  • Iterable - useful for generators.
  • Any - when it could be anything.
  • Union - when it could be anything within a specified set of types, as opposed to Any.
  • Optional - when it might be None. Shorthand for Union[T, None].
  • TypeVar - used with generics.
  • Callable - used primarily for functions, but could be used for other callables.

These are the most common type hints. A complete listing can be found in the documentation for the typing module.

Here is the old example using the annotation methods introduced in the typing module:

from typing import List

def pick(l: List[int], index: int) -> int:
    return l[index]

One powerful feature is the Callable which allows you to type annotate methods that take a function as an argument. For example:

from typing import Callable, Any, Iterable

def imap(f: Callable[[Any], Any], l: Iterable[Any]) -> List[Any]:
    """An immediate version of map, don't pass it any infinite iterables!"""
    return list(map(f, l))

The above example could become more precise with the usage of TypeVar instead of Any, but this has been left as an exercise to the reader since I believe I've already filled my answer with too much information about the wonderful new features enabled by type hinting.


Previously when one documented Python code with for example Sphinx some of the above functionality could be obtained by writing docstrings formatted like this:

def pick(l, index):
    """
    :param l: list of integers
    :type l: list
    :param index: index at which to pick an integer from *l*
    :type index: int
    :returns: integer at *index* in *l*
    :rtype: int
    """
    return l[index]

As you can see, this takes a number of extra lines (the exact number depends on how explicit you want to be and how you format your docstring). But it should now be clear to you how PEP 3107 provides an alternative that is in many (all?) ways superior. This is especially true in combination with PEP 484 which, as we have seen, provides a standard module that defines a syntax for these type hints/annotations that can be used in such a way that it is unambiguous and precise yet flexible, making for a powerful combination.

In my personal opinion, this is one of the greatest features in Python ever. I can't wait for people to start harnessing the power of it. Sorry for the long answer, but this is what happens when I get excited.


An example of Python code which heavily uses type hinting can be found here.

2 of 14
227

Python is strongly typed because every object has a type, every object knows its type, it's impossible to accidentally or deliberately use an object of a type "as if" it was an object of a different type, and all elementary operations on the object are delegated to its type.

This has nothing to do with names. A name in Python doesn't "have a type": if and when a name's defined, the name refers to an object, and the object does have a type (but that doesn't in fact force a type on the name: a name is a name).

A name in Python can perfectly well refer to different objects at different times (as in most programming languages, though not all) -- and there is no constraint on the name such that, if it has once referred to an object of type X, it's then forevermore constrained to refer only to other objects of type X. Constraints on names are not part of the concept of "strong typing", though some enthusiasts of static typing (where names do get constrained, and in a static, AKA compile-time, fashion, too) do misuse the term this way.

🌐
Python documentation
docs.python.org › 3 › library › functions.html
Built-in Functions — Python 3.14.3 documentation
February 27, 2026 - For a general Python object x, float(x) delegates to x.__float__(). If __float__() is not defined then it falls back to __index__(). See also float.from_number() which only accepts a numeric argument. If no argument is given, 0.0 is returned. The float type is described in Numeric Types — int, float, complex. Changed in version 3.6: Grouping digits with underscores as in code literals is allowed. Changed in version 3.7: The parameter is now positional-only.
🌐
Luis Llamas
luisllamas.es › inicio › cursos › curso python
Function Parameters and Arguments in Python
November 20, 2024 - The key "a" is assigned to parameter a, key "b" to b and key "c" to c · That is, it’s equivalent to calling sum(a=1, b=2, c=3) In Python, passing arguments to functions is always done by value (meaning the function always receives a copy of the argument).
🌐
GeeksforGeeks
geeksforgeeks.org › python › deep-dive-into-parameters-and-arguments-in-python
Python Function Parameters and Arguments - GeeksforGeeks
Parameters · Arguments · Types of arguments in python · A parameter is the variable defined within the parentheses when we declare a function. Example: Python · # Here a,b are the parameters def sum(a,b): print(a+b) sum(1,2) Output · 3 ...
Published   July 23, 2025
🌐
Built In
builtin.com › software-engineering-perspectives › arguments-in-python
5 Types of Python Function Arguments | Built In
In Python, a function is defined with def. This is followed by the name of the function and a set of formal parameters. The actual parameters, or arguments, are passed during a function call.
🌐
Reddit
reddit.com › r/learnpython › please help me understand functions and parameters..
r/learnpython on Reddit: Please help me understand functions and parameters..
February 3, 2023 -

I am trying really hard to understand specifically parameters. Particularly, when I define a function I.e. def function(parameter): print(parameter) And then call it function("a simple string") Is the parameter always going to be parameter? It's receiving a value, right? So... Maybe I'm like mentally deficit... or overthinking this, but what if I do..

def function(parameter0, parameter1, parameter3)
    print(parameter0, parameter1, parameter3)

And then call the function

function("Does this cause an error?", "Must have exact values", "for each parameter?")

Am I over thinking this? I'm just following lessons from a PDF. Python for the absolute beginner

I'm must confused and I'm not even sure how or why I'm confused.

  • Edit: formatting and typos

  • Update: Thanks everyone for your help. I think I am understanding it. I believe I'm overthinking it, and over reacting. Sorry for being difficult.

Top answer
1 of 4
5
So, taking a swing at it....the parameter(s) in Python are just a way of telling the function that it should be receiving one or more objects/pieces of information. How you write the function determines what type of object those things need to be. Per your example, def funct(param): print(param) Can be used with any type of object that can be printed out to the console; like: func(23) func("Hello, Timmy") will print out the value 23, and then the string "Hello, Timmy" What this, also, means is that you can assign things to variables and pass those variables in to the parameter spot (referred to as an argument when calling the function) and they will still be the object/type of object that you assigned earlier. a = [2, 5, 7, 9] func(a) will print [2, 5, 7, 9] out to the console. Does that help?
2 of 4
4
Everything in Python is an object (including integers, lists, functions, classes, etc) Variables are just names that refer to objects An object can have several names that refer to it, but each name can only directly refer to a single object (although that object can be a collection of other objects, like in a list or tuple) An area of code where a set of names is accessible is called a namespace (modules (files) and functions both hold a local namespace, and a function can access its local namespace as well as the global namespace of the module it’s being called in) When defining a function, the parameters define the names of the objects that get passed in to its local namespace (regardless of any extra names that may refer to those objects outside a function call), so those names can be used throughout the function (but are not accessible from outside the function) When calling a function the parameters are used to pass in objects this can be positionally, as in your example, or as keyword-arguments that specify which parameter name should be assigned to which object (e.g. my_func(a, 3, param=[], param8=var)) it doesn’t matter if the objects are passed in as literals (e.g. 3, "string") or variables - just the object (the “value”) is passed in and bound to the relevant parameter name Python interprets code from top to bottom If you define a new function with the same name as some other object, then that name now refers to that function, and has no memory of what it used to refer to (just like if you do a=3 and then later in your code do a=4)
🌐
Programiz
programiz.com › python-programming › function-argument
Python Function Arguments (With Examples)
Here, add_numbers(2, 3) specifies that parameters a and b will get values 2 and 3 respectively. In Python, we can provide default values to function arguments.
🌐
Codecademy
codecademy.com › docs › python › functions › arguments/parameters
Python | Functions | Arguments/Parameters | Codecademy
February 13, 2023 - Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today. ... Parameters are variables that are declared in the function definition. They are usually processed in the function body to produce ...
🌐
Codecademy
codecademy.com › learn › flask-introduction-to-python › modules › learn-python3-functions › cheatsheet
Introduction to Python: Functions Cheatsheet | Codecademy
A function can be called by writing the name of it, followed by parentheses. For example, the code provided would call the doHomework() method. ... Parameters in python are variables — placeholders for the actual values the function needs.
🌐
Real Python
realpython.com › ref › glossary › parameter
parameter | Python Glossary – Real Python
In Python, a parameter is a variable that you use in a function or method definition to accept input values, known as arguments, when the function is called.
🌐
Plain English
python.plainenglish.io › understanding-python-function-parameters-args-kargs-54a288de7110
Understanding Python Function Parameters (/, *args, *, **kargs) | by Py-Core Python Programming | Python in Plain English
December 11, 2024 - Python supports five key types of function parameters. Let’s look at each parameter type and discuss the specific rules on how they work and when to use them. We’ll examine each with examples, focusing on real-world applications. ... Positional-only parameters are defined using the / symbol in the function signature.
🌐
Hyperskill
hyperskill.org › university › python › parameters-in-python
Parameters in Python
August 15, 2024 - In Python parameters are like placeholders used in defining a function to determine how it behaves when invoked. They serve as placeholders for the values that will be supplied to the function during its execution. By setting parameters functions gain flexibility and reusability accommodating ...
🌐
Boot.dev
boot.dev › lessons › ddc9202b-8874-480b-8ec7-aec75f0eeaec
Learn to Code in Python: Parameters vs. Arguments | Boot.dev
To reiterate, arguments are the actual values that go into the function, such as 42.0, "the dark knight", or True. Parameters are the names we use in the function definition to refer to those values, which at the time of writing the function, ...