[EMAIL PROTECTED] napisaĆ(a): > [EMAIL PROTECTED]: > > As for the original prooblem, why not use > > defaultdict? I think it's the most idiomatic way to achieve what we > > want. And also the fastest one, according to my quick-and-dirty tests: > > It adds the new keys, I can't accept that:
Right, my fault not noticing that. I experimented further with __missing__ method and with "ask forgiveness" idiom (try... except KeyError) and they were both noticeably slower. So checking with "in" may be the most efficient way we have. Regards, Marek -- http://mail.python.org/mailman/listinfo/python-list