Paul Rubin wrote:

If the compiler can do some type inference, it can optimize out those
multiple calls pretty straightforwardly.

It can be tipped like that:

di = dict(int)
di.setdefault(0)
di[key] += 1

dl = dict(list)
dl.setdefault([])
dl.append("word")
dl.extend(mylist)

But the point is that if method not found in dict it delegated to container type specified in constructor.

It solves dict specialization without bloating dict class and is generic.

Mike

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to