P
Pete Forman
I have a set that contains one item. What is the best way of getting
at that item? Using pop() empties the set. Here is what I've tried.
Python 2.3.4 (#1, Jun 13 2004, 11:21:03)
[GCC 3.3.1 (cygming special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
File "<stdin>", line 1, in ?
TypeError: unindexable object
at that item? Using pop() empties the set. Here is what I've tried.
Python 2.3.4 (#1, Jun 13 2004, 11:21:03)
[GCC 3.3.1 (cygming special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):from sets import Set
s = Set(['foo'])
s.copy().pop() 'foo'
[x for x in s][0] 'foo'
s[0]
File "<stdin>", line 1, in ?
TypeError: unindexable object