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

D H d at e.f
Sat Jun 25 18:20:27 EDT 2005


Elmo Mäntynen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 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

The star (*n) means you are essentially calling tuple(100).  And 100 
alone isn't a sequence.  The star explodes or expands the sequence, like 
in this example:

def doit(x, y, z):
     print x, y, z

vals = (1,2,3)

doit(*vals)  #see the star symbol



More information about the Python-list mailing list