classification
Title: bug on showing tuple on console
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, kwutge, zach.ware
Priority: normal Keywords:

Created on 2021-07-18 21:27 by kwutge, last changed 2021-07-18 23:03 by zach.ware. This issue is now closed.

Files
File name Uploaded Description Edit
abc.png kwutge, 2021-07-18 21:27
Messages (3)
msg397759 - (view) Author: Toby Spooner (kwutge) Date: 2021-07-18 21:27
def func(a,b,c , *args , **kwargs):
    print(a)
    print(args)
    print(kwargs)

func(2,3,4,5,Carlson=240,Shehroz="maladiss")

# print(args) showing (5,). NEED TO FIX. python 3.9.6
msg397762 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python triager) Date: 2021-07-18 21:36
I don't know what behavior you were expecting, but *args means "the rest of the positional arguments", not "all of the positional arguments."

See https://docs.python.org/3/tutorial/controlflow.html?highlight=variadic#arbitrary-argument-lists
msg397763 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2021-07-18 23:03
As Dennis said, this isn't a bug. Try printing `b` and `c` as well, and you'll find 3 and 4.
History
Date User Action Args
2021-07-18 23:03:16zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg397763

resolution: not a bug
stage: resolved
2021-07-18 21:36:41Dennis Sweeneysetnosy: + Dennis Sweeney
messages: + msg397762
2021-07-18 21:27:05kwutgecreate