list comprehention

Matt matthew_shomphe at countrywide.com
Thu Jan 19 12:50:49 EST 2006


Tim Chase wrote:
<snip>
>
> I'm a tad confused by the help, as it sounds like sets are
> supposed to be first-class citizens, but in ver2.3.5 that I'm
> running here (or rather "there", on a friend's box), I have to
> "import sets" which I didn't see mentioned in the reference manual.
>
> -one of many tims on the list
> tim = Set(["bald", "vegetarian", "loving husband"])
>
> :)

The builtin "set" was added in 2.4, I believe (note lowercase "s"):

http://docs.python.org/whatsnew/node2.html

print "vegetarian".replace("etari","")
:-)




More information about the Python-list mailing list