Le Lundi 15 Mai 2006 21:07, Diez B. Roggisch a écrit : > > d={}.fromkeys(xrange(5*10**6)) ? > > That is a totally different beast. You don't want to insert arbitrary > keys, you want the internal hash-array to be of the right size.
But you can replace the xrange part by any generator function you want. def get_mykeys(..) ... yield key I just the wonder if the time consuming part is the memory allocation of hash table (key by key) or the hash operation itself. I don't see a use case where a python programmer should need a dictionnary "that will be probably big" but can't predict what keys will be in. -- _____________ Maric Michaud _____________ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 426 880 097 -- http://mail.python.org/mailman/listinfo/python-list