[Tutor] t = (1, *(2, 3))

Stefan Behnel stefan_ml at behnel.de
Fri May 15 08:07:41 CEST 2009


Jabin Jezreel wrote:
> I am not allowed to do
>>>> t = (1, *(2, 3))
> 
> But I am allowed to do
>>>> def ts(*t):
> ...    return t
> ...
>>>> ts(1, *(2, 3))
> (1, 2, 3)
> 
> I realize I can do
>>>> (1,) + (2,3)
> (1, 2, 3)
> 
> What is the rationale behind not having t = (1, *(2, 3))
> have the same semantics as the "ts" case above?

They are different things. However, I think a proposal to make the above
work sounds like a good thing to bring up on the python-ideas list.

Stefan



More information about the Tutor mailing list