Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Paul Rubin wrote: > >> "n00m" <[EMAIL PROTECTED]> writes: >>> h = collections.defaultdict(itertools.repeat(0).next) >> Something wrong with >> h = collections.defaultdict(int) >> ????? > > According to a post by Raymond Hettinger it's faster to use that iterator > instead of `int`.
Yep. It's because the .next() method takes no arguments, while int() takes varargs because you can do:: int('2') int('2', 8) Calling a no-args function is substantially faster than calling a varargs function. STeVe -- http://mail.python.org/mailman/listinfo/python-list