[EMAIL PROTECTED] wrote: > ''%([]) doesn't raise exception > but > ''%('') does > > Can anyone explain me why??
That is a side-effect of duck-typing. The duck-type of an empty list is indistinguishable from that of an empty dictionary. Not testing the exact type here achieves consistency with the behaviour of custom dictionaries, e. g: >>> class List(list): ... def __getitem__(self, index): ... return list.__getitem__(self, int(index)) ... >>> "%(0)s" % List([42]) '42' >>> "%(1)s %(0)s" % List([42, 24]) '24 42' >>> "" % List([]) '' Peter -- http://mail.python.org/mailman/listinfo/python-list