[Python-sets] RE: Python-sets digest, Vol 1 #23 - 2 msgs

Magnus Lie Hetland mlh at idi.ntnu.no
Thu Jun 7 21:33:36 CEST 2001


From: "Greg Wilson" <Greg.Wilson at baltimore.com>
To: <python-sets at lists.sourceforge.net>
Sent: Thursday, June 07, 2001 9:23 PM
Subject: [Python-sets] RE: Python-sets digest, Vol 1 #23 - 2 msgs


> > From: "Magnus Lie Hetland" <mlh at idi.ntnu.no>
> > I was thinking about the possibility of dictionary
> > comprehension a minute ago (I vaguely recollect doing
> > so before...) and came to think of the set comprehension
> > syntax... Would it be possible to have two different
> > syntaxes like this:
> >   {v:k for k, v in dict.iteritems()}
> > (or {dict[k]:k for k in dict})
> > and
> >   {v for k in dict}
> 
> Check out Guido's call for comments on int, str, tuple,
> etc. becoming type objects:
> 
> http://mail.python.org/pipermail/python-dev/2001-June/015256.html
> 
> and followups that talked about dictionary construction syntax;
> is there a way to marry the two syntaxes?

I assume you refer to the proposed dict function? I think that
would be a very nice feature too - to be able to "get back"
from dict.items(). However, this is more of a parallel to the
list function, isn't it? While dictionary comprehension is more
of a parallel (obviously) to list comprehension...

As far as I can see, there is no need to marry the syntaxes,
since they do different things.

If this isn't what you mean, perhaps you could point me to
a specific posting? :)

> Greg

--

  Magnus Lie Hetland         http://www.hetland.org

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick






More information about the Python-list mailing list