On Oct 2, 11:20 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > You can do the following: > > a = [1,2,3,4,5] > del a[0] > > and > > a = {1:'1', 2: '2', 3: '3', 4:'4', 5:'5'} > del a[1] > > why doesn't it work the same for sets (particularly since sets are based on a > dictionary)? > > a = set([1,2,3,4,5]) > del a[1] > > Yes I know that sets have a remove method (like lists), but since dictionaries > don't have a remove method, shouldn't sets behave like more like dictionaries > and less like lists? IMHO del for sets is quite intuitive. I guess it is too > late to change now. > > -Larry
>>> a = set( range(5) ) >>> a[0] Traceback (most recent call last): File "<pyshell#15>", line 1, in <module> a[0] TypeError: 'set' object is unindexable No point it needing to be indexable either. It's also worth noting that removing an object from a container (.remove) is different than proposing the object goes to GC (del...) Have to disagree that del[] on a set makes any sense. Tired, and it's late, so probably typing rubbish, but felt okay when I started reading the group :) Jon. -- http://mail.python.org/mailman/listinfo/python-list