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 sam
> > >>> x = (2, 3)
> > >>> y = (1, *x)
> > File "", line 1
> > SyntaxError: can use starred expression only as assignment target
>
> But you can already do that without needing to extend * notation
> to work like that
To me the "*" notation already /appears/ to work like that:
(Python 3.x)
>>
On Thu, May 14, 2009 at 11:10:53AM -0700, Jabin Jezreel wrote:
> > Why not just write is simply as (1, 2, 3) instead of
> > the confusing (1, *(2, 3))?
>
> It is a contrived example. In practice it would be
> something more like:
>
> >>> def ts(*t):
> ... return t
> ...
> >>> x = (2, 3)
> >>
> Why not just write is simply as (1, 2, 3) instead of
> the confusing (1, *(2, 3))?
It is a contrived example. In practice it would be
something more like:
>>> def ts(*t):
... return t
...
>>> x = (2, 3)
>>> y = (1, *x)
File "", line 1
SyntaxError: can use starred expression only as assig
Steve Willoughby wrote:
Lie Ryan wrote:
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))
hav
Lie Ryan wrote:
> 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
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 abo
"Jabin Jezreel" wrote
I am not allowed to do
>>> t = (1, *(2, 3))
Just to be clear, what do you think this means?
What would you expect to happen?
But I am allowed to do
>>> def ts(*t):
... return t
...
>>> ts(1, *(2, 3))
(1, 2, 3)
What do you think is happening here that is different?