[Python-Dev] Re: Sets: elt in dict, lst.include

Thomas Wouters thomas@xs4all.net
Mon, 29 Jan 2001 15:58:16 +0100


On Mon, Jan 29, 2001 at 09:48:22AM -0500, Guido van Rossum wrote:

> How about:

>     for key in dict: ...		# ... over keys

>     for key:value in dict: ...		# ... over items

> This is syntactically unambiguous (a colon is currently illegal in
> that position).

I won't comment on the syntax right now, I need to look at it for a while
first :-) However, what about MAL's point about dict ordering, internally ?
Wouldn't FOR_LOOP be forced to generate a list of keys anyway, to avoid
skipping keys ? I know currently the dict implementation doesn't do any
reordering except during adds/deletes, but there is nothing in the language
ref that supports that -- it's an implementation detail. Would we make a
future enhancement where (some form of) gc would 'clean up' large
dictionaries impossible ?

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!