Which module is "set " in?

Steven Bethard steven.bethard at gmail.com
Fri Feb 25 23:53:36 EST 2005


Anthony Liu wrote:
> I want to use the set function like
> 
>     mylist = ['a', 'b', 'b', 'd', 'e', 'a']
>     myset  = set (mylist)
> 
> But I don't know what to import, I tried sys, sets,
> they don't work.

If you're using Python 2.4, they're builtin.  If you're using Python 
2.3, you'll probably want to do something like:
     from sets import Set as set
Python's before 2.3 do not have a set type.

> What's the easy way to find out the module that
> contains a particular function?

Perhaps the documentation index?

http://docs.python.org/lib/genindex.html

Steve



More information about the Python-list mailing list