[Python-3000] Immutable lists
Nick Coghlan
ncoghlan at gmail.com
Thu May 25 12:00:32 CEST 2006
Greg Ewing wrote:
> Nick Coghlan wrote:
>
>> This is exactly what I was trying to get at when I suggested using
>> "tuple[T]" as the notation for an arbitrary length tuple with elements
>> of type T
>
> If tuple[T] is an arbitrary-length tuple, then how
> do you spell a 1-tuple with element type T?
(T,)
> > and "T1, T2" as the notation for a 2-tuple with the first
>> element of type T1 and the second element of type T2.
>
> It's been pointed out that making (T1, T2) equivalent to
> tuple[T1, T2] leads to an inconsistency. That needs to be
> resolved before taking this idea any further.
Yes - I'm saying tuple[T1, T2] should describe an arbitrary length tuple whose
elements are 2-tuples, *instead* of being equivalent to (T1, T2).
Since we have 2 notations (a tuple of type descriptions, and a subscript
operation on the tuple type) and 2 concepts to be expressed (a type
description for a heterogeneous tuple and a type description for an arbitrary
length tuple), it makes sense to me to use one of the notations for each
concept rather than making the two notations mean the same thing.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list