A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

Robert Kern rkern at ucsd.edu
Sun Jun 26 00:15:42 CEST 2005

Elmo Mäntynen wrote:
> Hash: SHA1
> This is the case:
>>>>n=(100,) tuple(*n)
> Traceback (most recent call last):
>   File "<pyshell#31>", line 1, in -toplevel-
>     tuple(*n)
> TypeError: iteration over non-sequence

n is a sequence. *n correctly expands. The error is that 100 is not a 
sequence; tuple() requires a sequence or an iterator. tuple(*n) is 
equivalent to tuple(100).

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