473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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

To be sure I searched for ways to check if something is a sequence:
n.__iter__().next() 100 n.__getitem__(0) 100 iter(n).next()

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+AJ9oEyL7sufkXCcsQxuMDv yxNqvGGACglBrF
le8HmOgXAyRqAY3DASArjM4=
=F9NR
-----END PGP SIGNATURE-----

Jul 19 '05 #1
1 986
D H
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
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Elbert Lev | last post by:
# here is the problem I ran into: class foo: def __init__(self, host): self.f() self.r = True def f(self): if self.r: #<do something>
4
by: Tomasz Lisowski | last post by:
Hi, We are distributing our Python application as the short main script (.py file) and a set of modules compiled to the .pyc files. So far, we have always treated .pyc files as portable between...
13
by: Neil Zanella | last post by:
Hello, I wonder whether anyone has ever come across the following g++ compiler error message. I don't recall ever seeing it before. I solved my problem but I am still not sure about what this...
4
by: Sigurd Bruteig | last post by:
If i type NewRecord in some code, VB change to newrecord with lower-case letter. If I open a new database on the same computer the NewRecord keyword act normally. Ha anybody experienced something...
1
by: John | last post by:
Hi First of all apologies for posting so much code but this is rather involved and I am totally stumped. Basically I have a main form (Staff Batch SMS/E-Mail) which calls a function (SendSMS) in...
8
by: K. Shier | last post by:
when i have the following code inside the .vb file that defines 'Public MustInherit Class frmDataEntry', if i try to open a derived form based on frmDataEntry, i get an error "Could not find any...
12
by: ishtar2020 | last post by:
Hi everybody I've been writing my very first application in Python and everything is running smoothly, except for a strange problem that pops up every once in a while. I'm sure is the kind of...
19
by: Alan Carpenter | last post by:
Access 8 on Win98 and WinXP I'm having trouble with wildcards in the .Filename property of the FileSearch Object giving different results on win98 and XP. I've been successfully using...
1
by: John Kotuby | last post by:
Hi all. I am using VS 2005 and VB.NET. Lately as my Web Application is getting larger, I have been getting strange compiler messages like the following: --------------------------- Compiler...
8
by: Rinaldo | last post by:
Hi, When I start my program in the debugger, there is no problem, but when not I get an exception. It appears in: private void Upload(string filename, string FTnaam) { MessageBox.Show("in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.