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

2009-05-14 Thread Stefan Behnel
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

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

2009-05-14 Thread Larry Riedel
> > >>> 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) >>

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

2009-05-14 Thread Steve Willoughby
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) > >>

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

2009-05-14 Thread Jabin Jezreel
> 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

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

2009-05-14 Thread Lie Ryan
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

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

2009-05-14 Thread Steve Willoughby
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

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

2009-05-14 Thread Lie Ryan
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

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

2009-05-14 Thread Alan Gauld
"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?