Sideway
output.to from Sideway
Draft for Information Only

Content

Python Variable-length Variable List
 Python *arg and **kwarg
  *args
  **kwargs
 Python Packing and Unpacking
  Python Argument Packing and Unpacking
   *args Packing
   *args Unpacking
  Python Keyword Argument Packing and Unpacking
   **kwargs Packing
   **kwargs Unpacking
 Source and Reference

Python Variable-length Variable List

A Python variable is created by assigning a value to a variable name. Besides standard python variable, there are two special variable syntaxes used in python to assign a variable-length variable list to a variable name. They are *args and **kwargs

Python *arg and **kwarg

Python *arg and **kwarg syntaxes are designed for representing a simple sequence and a keyword sequence.

*args

For *args, * is the syntax symbol to indicate a variable-length variable list. args is the variable name of the variable list. *args is used to represent a variable-length of non-keyworded argument list. *args can also be used to pass a variable number of arguments to a function.

**kwargs

For **kwargs: ** is the syntax symbol to indicate a variable-length keyword variable list. kwargs is the variable name of the keyword variable list. **kwargs is used to represent a variable-length of keyworded argument list. **kwargs can also be used to pass a variable number of keyworded arguments to a function.

Python Packing and Unpacking

The interpretation mechanism of Python *arg and **kwarg syntaxes involves the packing and unpacking the variable-length variable list of a varable

Python Argument Packing and Unpacking

Python *args is used to pack a variable-length of non-keyworded argument list into the variable args. Python *args can also be used to unpack the variable-length of non-keyworded argument list of variable args into a variable-length of non-keyworded argument sequence.

*args Packing

Python *args packing is used to create a new variable-length of non-keyworded argument list by packing a copy of assigned non-keyworded arguments into the variable args accordingly. image

*args Unpacking

Python *args unpacking is used to create a new variable-length of non-keyworded argument sequence by unpacking a copy of the non-keyworded arguments of variable name args accordingly. image

Python Keyword Argument Packing and Unpacking

Python **kwargs is used to pack a variable-length of keyworded argument list into the variable kwargs. Python **kwargs can also be used to unpack the variable-length of keyworded argument list of variable kwargs into a variable-length of keyworded argument sequence.

**kwargs Packing

Python *kwargs packing is used to create a new variable-length of keyworded argument list by packing a copy of assigned keyworded arguments into the variable kwargs accordingly. image

**kwargs Unpacking

Python **kwargs unpacking is used to create a new variable-length of keyworded argument sequence by unpacking a copy of the keyworded arguments of variable name kwargs accordingly. image

Source and Reference


©sideway

ID: 200502202 Last Updated: 22/5/2020 Revision: 0

IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 337

Reference 67

Computer

Hardware 149

Software

Application 198

Digitization 117

Numeric 19

Programming

Web 283

Unicode 494

HTML 65

CSS 58

ASP.NET 92

OS 389

DeskTop 7

Python 19

Knowledge

Mathematics

Formulas 8

Algebra 25

Number Theory 206

Trigonometry 18

Geometry 18

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Physics

Electric 27

Biology 1

Geography 1


Copyright © 2000-2020 Sideway . All rights reserved Disclaimers last modified on 06 September 2019