Best way to compare the contents of two directories

Steven Bethard steven.bethard at gmail.com
Mon Sep 13 16:47:47 EDT 2004


Cliff Wells <clifford.wells <at> comcast.net> writes:
> 
> I think sets were added in 2.3, but either way you must still 'from sets
> import Set' before using them.

It also might be good to get in the habit of writing this as:

from sets import Set as set

so that when you move to Python 2.4, where set() is a builtin, all you have to 
do is remove the import.

Python 2.4a3 (#56, Sep  2 2004, 20:50:21) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> set(abs(2*i - 6) for i in range(10))
set([0, 2, 4, 6, 8, 10, 12])

Steve




More information about the Python-list mailing list