On 5/23/06, Gareth McCaughan <[EMAIL PROTECTED]> wrote: > On Saturday 2006-05-20 20:53, Guido van Rossum wrote: > > > On 5/20/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > > > How about just dict[str:int]? > > > > A bit too clever, although it happens to work syntactically -- it > > calls dict.__getitem__(slice(str, int)). > > Hmm. Why "too clever"?
Because you're creatin a correspondence between two entirely unrelated usages of ':' -- the usage in a dict display is unrelated (and totally different in nature) than the usage in slices. > The symmetry with the syntax for dict literals > is nice, and (to me) it's more instantly apparent that the LH type > is the key and the RH type the value than with dict[str, int]. > > Now, Function[(int, int, int): float] isn't so good. ... Then again, > Function(int, int, int): float is pretty nice. What was the compelling > reason for not allowing bare slice literals, again? :-) It's ambiguous, e.g. if you put it at the top level of the condition in an if statement. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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
