Parallel arithmetic?

Robert Kern rkern at ucsd.edu
Thu Aug 4 22:11:23 EDT 2005


Terrance N. Phillip wrote:
> Thank-you very much for all the excellent replies. I'm thinking of using 
> this to determine if a sequence is a "run" (as in a card game). If I've 
> got a sorted hand [3, 4, 5, 6, 7], then I know I've got a 5-card run 
> because [4, 5, 6, 7] - [3, 4, 5, 6] == [1, 1, 1, 1]. I want to avoid 
> something like
> if h[0] == h[1]-1 and h[1] == h[2]-1 ...

In that case:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/415504

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list