How to get an item from a simple set?

Pete Forman pete.forman at westerngeco.com
Wed Nov 24 12:04:34 EST 2004


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

> I still tend to write the extra line in cases like this -- it
> guarantees that the set is really the size that I think it is, where
> the iter(s).next() solution will not raise an exception if the set
> is actually larger.

The preceding line in my code is
  if len(s) == 1:

:-)
-- 
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