Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"?
Amaury
afa.NOSPAM at neuf.fr
Sun Nov 13 07:52:36 EST 2005
Hello,
Daniel Crespo wrote:
> Is there a built-in method for transforming (1,None,"Hello!") to
> 1,None,"Hello!"?
As others answered before, the two syntaxes build the same object, so
there is no need to convert.
Except if you already have the tuple stored in a variable, and want to
call a function with the tree arguments:
args = (1,None,"Hello!")
func(args) # equivalent to func((1,None,"Hello!"))
func(*args) # equivalent to func(1,None,"Hello!")
Note the '*' on the second call, it will flatten the args, and 3
arguments are passed to the function.
--
Amaury
More information about the Python-list
mailing list