On Thu, Nov 01, 2001 at 05:40:31PM -0600, Ian Bicking wrote:
> Chuck Esterbrook <[EMAIL PROTECTED]> wrote:
> > >(Still hoping Python gets sets someday, pardon the pun.  You can mimic
> > >them with dictionaries, but that's like driving a car across the street
> > >to get the mail.)
> > 
> > I agree. It would also fit better with what MiddleKit is currently calling 
> > a "list" but for which it doesn't really guarantee an order.
> > 
> > I think list, set and map are the 3 Big Containers that every language 
> > should have.
> 
> I think dictionaries make for pretty decent sets.  Just like lists
> make for decent stacks and queues (well, once we got the thread-safe
> .pop()).

Lists work very well for stacks or queues, and the other features of
lists (random access) don't get in the way.  But with
dictionaries-as-sets, every time you add a key you have to make up a
bogus value.  None is the most obvious choice, but that evaluates to
false so it's a little misleading.  On the other hand, 1 is suitably
true, but it's even more misleading.

Less of a problem is having to do mySet.has_key(Thing) instead of
"Thing in mySet", although I guess maybe you can do that in Python 2.2.  

-- 
-Mike (Iron) Orr, [EMAIL PROTECTED]  (if mail problems: [EMAIL PROTECTED])
   http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to