How to get an item from a simple set?

Pete Forman pete.forman at westerngeco.com
Fri Nov 26 07:34:04 EST 2004


Steven Bethard <steven.bethard at gmail.com> writes:

 > So is this just one branch of a case statement?  What do you do in
 > the case that len(s) != 1?  And which one happens more often?

My s contains a set of possible values that are being refined.  I'm
printing either a single resolved value or "many" to indicate there is
still some way to go.  len(s) > 1 is not exceptional though len(s) ==
0 would be.  Over the run of the program one and many will happen
equally often.  Performance is less of an issue than clarity of the
code.
-- 
Pete Forman                -./\.-  Disclaimer: This post is originated
WesternGeco                  -./\.-   by myself and does not represent
pete.forman at westerngeco.com    -./\.-   opinion of Schlumberger, Baker
http://petef.port5.com           -./\.-   Hughes or their divisions.



More information about the Python-list mailing list