On 5/22/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 5/22/06, Collin Winter <[EMAIL PROTECTED]> wrote: > > The main use case I'm thinking of is parameterizing mapping types. Say > > I wanted a set of Number lists: in Python 2, I'd just convert the > > lists to tuples before adding them to the set. However, in Python 3, > > converting the lists to tuples will cause any annotations like > > set[list[Number]] to reject the candidate set. I'd like to avoid > > having annotations like set[tuple & EveryElementIs(Number)]. Also, > > before anyone proposes it, I don't think "just remove the offending > > annotations" is a viable solution. > > You should be able to declare it as set[ImmutableSequence[Number]] and > a set containing tuples would match that.
Is Python 3 going to ship with a set of these interface definitions? I thought the plan was to leave things like this up to external libraries, but if a crucial role for a built-in type (like what you've described) is going to need an ImmutableSequence interface to be correctly annotated, then....I think you can see where I'm going with this. Perhaps we should go with Tony Lownds' suggestion of tuple[T] is an arbitrary-length tuple and tuple[T,] is a 1-tuple? Collin Winter _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
