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.
--
-Echo 1 1073
Echo wrote: 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.
-- -Echo
I think you meant to write:
[t for t in __import__(m, globals(), locals(), m).BizObjects() for m
in table_files]
-Larry Bates This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Elaine Jackson |
last post by:
List comprehensions don't work the way you intuitively expect them to work. I
realize many people have no intuitions about how list comprehensions 'should'
work, so if you recognize yourself in...
|
by: Mahesh Padmanabhan |
last post by:
Hi,
When list comprehension was added to the language, I had a lot of
trouble understanding it but now that I am familiar with it, I am not
sure how I programmed in Python without it.
Now I...
|
by: Neuruss |
last post by:
I have a doubt regarding list comprehensions:
According to Mark Lutz in his book Learning Pyhon:
"...there is currently a substantial performance advantage to the
extra complexity in this case:...
|
by: Mike Meyer |
last post by:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit...
|
by: Steven Bethard |
last post by:
George Sakkis wrote:
> "Steven Bethard" <steven.bethard@gmail.com> wrote:
>> Dict comprehensions were recently rejected:
>> http://www.python.org/peps/pep-0274.html
>> The reason, of course,...
|
by: Steven Bethard |
last post by:
Tom Anderson <twic@urchin.earth.li> wrote:
> Sounds good. More generally, i'd be more than happy to get rid of list
> comprehensions, letting people use list(genexp) instead. That would
>...
|
by: Lonnie Princehouse |
last post by:
List comprehensions appear to store their temporary result in a
variable named "_" (or presumably "_", "_" etc for nested
comprehensions)
In other words, there are variables being put into the...
|
by: beginner |
last post by:
Hi All,
If I have a list comprehension:
ab=
c = "ABC"
print c
|
by: John Salerno |
last post by:
I posted this code last night in response to another thread, and after I
posted it I got to wondering if I had misused the list comprehension. Here's
the two examples:
Example 1:...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |