[Python-3000] a slight change to __[get|set|del]item__
Guido van Rossum
guido at python.org
Tue May 30 05:28:24 CEST 2006
On 5/27/06, Just van Rossum <just at letterror.com> wrote:
> Oleg Broytmann wrote:
>
> > On Sat, May 27, 2006 at 03:15:32PM +0200, tomer filiba wrote:
> > > which makes it impossible to diffrenciate between
> > > >>>y[1, 2]
> > > (1, 2)
> > >
> > > and
> > > >>>y[(1, 2)]
> > > (1, 2)
> >
> > Tuples are not created with parenthesizes. Tuples are created with
> a comma. Hence
> >
> > 1, 2
> >
> > *is* a tuple. Just as (1, 2).
>
> But
>
> foo(1, 2)
>
> isn't the same as
>
> foo((1, 2))
Because the (...) in a function call isn't a tuple.
I'm with Oleg -- a[x, y] is *intentionally* the same as a[(x, y)].
This is a feature; you can write
t = x, y # or t = (x, y)
and later
a[t]
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list