<p>Suppose the following:</p>

<pre><code>&gt;&gt;&gt; s = set([1, 2, 3])
</code></pre>

<p>How do I get a value (any value) out of <code>s</code> without doing <code>s.pop()</code>? I want to leave the item in the set until I am sure I can remove it - something I can only be sure of after an asynchronous call to another host.</p>

<p>Quick and dirty:</p>

<pre><code>&gt;&gt;&gt; elem = s.pop()
&gt;&gt;&gt; s.add(elem)
</code></pre>

<p>But do you know of a better way? Ideally in constant time.</p>

Two options that don't require copying the whole set:
```
```
for e in s:
    break
# e is now an element from s
```
```
Or...
```
```
e = next(iter(s))
```
```
But in general, sets don't support indexing or slicing.