Leo <dontsendleos...@gmail.com> added the comment:

Thanks for the suggestions "random.sample(s, 1)[0]" and 
"x=next(iter(s))". 

A counterpoint: isn't this a classic example of where polymorphism 
enables a more elegant, simple, and clear (dare I say Pythonic) 
approach? The complexity of allowing sets as inputs, even with a naive 
implementation, is still O(n) even in the worst case vs. O(1) for 
arrays. Isn't documenting that distinction good enough?

Thanks,
Leo.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7522>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to