Python
What does ...
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
What does *p mean in method declaration def my_func(*p) in Python?
It tells interpreter that p is a pointer to some value
It passes argument p by copy, not by value
It means that all changes that happen to p inside the method will be visible from outside of method scope
It means that p may have variable number of values inside of it
Explanation
This notation allows developers to pass variable number of values into function. In this case p is a list that contains all of them. This method can be called like this, for example,
my_func(1, 2, 3)
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
P
ython
Quiz
Login to learn Python
or
Read more about
Python Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
Python quizzes
Consider following code: switch ("a") { case...
What will be the value of out after executing the code? ...
Consider following code snippet: var r = ['a', 'l', 'p', 'h']; ...
How do you loop through objects in an array?...
Select the name of the String method that returns the position of first occurren...
What is the correct JavaScript syntax to disable right mouse click on your web p...
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment