[go: up one dir, main page]

0% found this document useful (0 votes)
11 views1 page

Key Word Variables Length Arguments

The document explains the concept of Keyword Variable Length Parameters in Python, which allows a single function definition to accept multiple keyword arguments without the need for multiple function definitions. It describes the syntax for defining such functions, emphasizing that the parameter must be preceded by double asterisks and must be placed at the end of the function's parameter list. The document also outlines the rules regarding the use of these parameters, including that only one Keyword Variable Length Parameter can be defined.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Key Word Variables Length Arguments

The document explains the concept of Keyword Variable Length Parameters in Python, which allows a single function definition to accept multiple keyword arguments without the need for multiple function definitions. It describes the syntax for defining such functions, emphasizing that the parameter must be preceded by double asterisks and must be placed at the end of the function's parameter list. The document also outlines the rules regarding the use of these parameters, including that only one Keyword Variable Length Parameter can be defined.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

================================================

5) Key Word Variables Length Parameters (or) arguments


================================================
=>When we have family of multiple function calls with Key Word Variable number of
values / arguments then with normal python programming, we must define mutiple
function defintions. This process leads to more development time.
=>To overcome this process, we must use the concept of Keyword Variable length
Parameters .
=>To Implement, Keyword Variable length Parameters concept, we must define single
Function Definition and takes a formal Parameter preceded with a symbol called
double astrisk ( ** param) and the formal parameter with double astrisk symbol is
called Keyword Variable length Parameters and whose purpose is to hold / store any
number of (Key,Value) coming from similar function calls and whose type is <class,
'dict'>.
-----------------------------------------------------------------------------------
----------------
Syntax for function defining with Keyword Variables Length Parameters:
-----------------------------------------------------------------------------------
----------------
def functionname(list of formal params, **param) :
--------------------------------------------------
--------------------------------------------------

=>Here **param is called Keyword Variable Length parameter and it can hold any
number of Key word argument values (or) Keyword variable number of argument values
and **param type is <class,'dict'>

=>Rule:- The **param must always written at last part of Function Heading and it
must be only one (but not multiple)
---------------------------------------------------------------
Final Syntax for defining a Function
---------------------------------------------------------------
def funcname(List of PosFormal parms, *Varlenparam, default params,
**kwdvarlengthParam):
-------------------------------------------------
---------------------------------------------------

=============================================X=====================================
===============

You might also like