beginer question of list comprehensions

E

Echo

Ok, this is the first list comprehension that I have done.
Surprisinly, it works for the most part.
The problem with it is that it returns a list with two lists in it,
instead of just one list. Can anyone tell me what I am doing wrong or
how to fix it.

Here is my code:
[t for t in (__import__(m, globals(), locals(), m).BizObjects() for m
in table_files)]

"table_files" is a list with two module names
"__import__(m, globals(), locals(), m).BizObjects()" is a list of
objects gotten from the module.
 
L

Larry Bates

Echo said:
Ok, this is the first list comprehension that I have done.
Surprisinly, it works for the most part.
The problem with it is that it returns a list with two lists in it,
instead of just one list. Can anyone tell me what I am doing wrong or
how to fix it.

Here is my code:
[t for t in (__import__(m, globals(), locals(), m).BizObjects() for m
in table_files)]

"table_files" is a list with two module names
"__import__(m, globals(), locals(), m).BizObjects()" is a list of
objects gotten from the module.

I think you meant to write:

[t for t in __import__(m, globals(), locals(), m).BizObjects() for m
in table_files]

-Larry Bates
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top