On Mon, 2005-01-31 at 12:34, Kent Johnson wrote: > Kent Johnson wrote: > > Note that Python 2.4 has set built-in with the name 'set'. To be > > compatible with both you could write > > try: > > set > > except NameError: > > from sets import Set as set > > Clarification: you don't _have_ to do this to be compatible with 2.4. The sets module is in both 2.3 > and 2.4. The difference in 2.4 is that set is also a built-in data type implemented in C with the > same interface as sets.Set. The code above will take advantage of the built-in set if it is > available, otherwise use sets.Set. > In 2.4 I tried 'from sets import set'
Traceback (most recent call last): File "/home/glen/set4.py", line 1, in -toplevel- from sets import set ImportError: cannot import name set It did allow 'from sets import *' but when using the set command I got some odd output... from sets import * a=[12,54,67,47,98,76] b=[47,54] print set(a)-set(b) >>> set(['dog','sheep,'cow']) set([76, 98, 67, 12]) >>> It seems to save the output from the last use, and reproduces it later, even after a system reboot I got the same output. Using the inbuilt commands works fine. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor