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

  • Thread starter =?ISO-8859-1?Q?Elmo_M=E4ntynen?=
  • Start date
?

=?ISO-8859-1?Q?Elmo_M=E4ntynen?=

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is the case:

Traceback (most recent call last):
File "<pyshell#31>", line 1, in -toplevel-
tuple(*n)
TypeError: iteration over non-sequence

To be sure I searched for ways to check if something is a sequence:
100

So as you see, as far as I can see, I gave a sequence, but the
Traceback says the opposite.
To me it seems like a bug, but I haven't filed any bugs before, so a
little help wouldn't be bad. I haven't checked if there is bug for
this, but I don't consider me finding a bug as obvious as this very
propable and something like this not to be fixed a long time ago.

I tried this with python 2.3 and 2.4.

If possible, could you send any anwsers to my own address also. Thanks
in advance.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCvdUActNFyQJObrsRAha+AJ9oEyL7sufkXCcsQxuMDvyxNqvGGACglBrF
le8HmOgXAyRqAY3DASArjM4=
=F9NR
-----END PGP SIGNATURE-----
 
D

D H

Elmo said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is the case:




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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top