Suppose the following:
>>> s = set([1, 2, 3])
How do I get a value (any value) out of s
without doing s.pop()
What I usually do for small collections is to create kind of parser/converter method like this
def convertSetToList(setName):
return list(setName)
Then I can use the new list and access by index number
userFields = convertSetToList(user)
name = request.json[userFields[0]]
As a list you will have all the other methods that you may need to work with
How about s.copy().pop()
? I haven't timed it, but it should work and it's simple. It works best for small sets however, as it copies the whole set.