Prasad, Ramit wrote:
I believe that the usage of 'in ' converts it into a set (or
set-like) object so probably that is the same as set(list(set())).
No, certainly not. That would be terribly inefficient, since it means first
iterating over blah entirely to convert it into a set, and then iter
Ali Torkamani wrote:
I could resolve it by defining a small function:
def getValue(mydict,keys):
A=[];
for i in keys:
A=A+[mydict[i]]
return A
That will be terribly, painfully inefficient for large amounts of data. Do you
understand Big O notation? The above is O(N**2), c
Alan Gauld wrote:
On 06/07/12 22:16, Ali Torkamani wrote:
have the pdb.set_trace()'s for debugging, to see what's going on inside.
So what does it show?
If you aren't using it get rid of it. The less distractions there are
the easier it is to debug things.
I find it ironic that you are s
Ali Torkamani wrote:
Dear Tutors,
I'm trying to write a dictionary into a csv file, in the following code
FlatData is the global dictionary whose keys are datetime objects, and the
values are list of dictionaries. sCommonFeatures are key's that exist in
all of such 'sub'-dictionaries, and sOtherF
On 06/07/12 22:16, Ali Torkamani wrote:
Actually printing some thing after that line does not show any thing,
OK, But it could be any of the lines above the print.
Why are you so sure its that line? You are probably correct but I'd like
to know why you are so sure? What have you done to isolat
> > Also what are you using the pdb traces for?
> > Do they show any output?
> Actually printing some thing after that line does not show any thing, I have
> the pdb.set_trace()'s for debugging, to see what's going on inside. ho would
> you debug that?
When debugging, I usually just add more pri
Please stop top posting, you have been asked at least once before, no
further comments, TIA.
On 06/07/2012 22:16, Ali Torkamani wrote:
Actually printing some thing after that line does not show any thing, I
have the pdb.set_trace()'s for debugging, to see what's going on inside. ho
would you de
Actually printing some thing after that line does not show any thing, I
have the pdb.set_trace()'s for debugging, to see what's going on inside. ho
would you debug that?
On Fri, Jul 6, 2012 at 3:57 PM, Alan Gauld wrote:
> On 06/07/12 18:21, Ali Torkamani wrote:
>
>> I'm using Python 2.7.
>> By st
On 06/07/12 18:21, Ali Torkamani wrote:
I'm using Python 2.7.
By stuck I mean, does not pass that specific line (but no errors).
How do you know that is the line it is stuck on?
def WriteOneDayToCSV(sCommonFeatures,sOtherFeatures,date):
FD=FlatData[date]
A=['UniqeDate','Year','Month','Da
I'm using Python 2.7.
By stuck I mean, does not pass that specific line (but no errors).
Like I said FD is a list of dictionaries. and sCommonFeatures are a subset
of key's that have value in all of the dictionaries.
On Fri, Jul 6, 2012 at 1:04 PM, Prasad, Ramit wrote:
> > > I could resolve it
> > I could resolve it by defining a small function:
> >
> > def getValue(mydict,keys):
> > A=[];
> > for i in keys:
> > A=A+[mydict[i]]
> > return A
> >
> > and then calling it: D=getValue(prog,sCommonFeatures);
> > (instead of D=[prog[key1] for key1 in list(sCommonFeatures)];)
Please do not top post.
>
> BTW I changed it to:
> D=[prog[key1] for key1 in list(sCommonFeatures)]
>
> because sCommonFeatures is actually a set, but it still has the smae problem
> On Fri, Jul 6, 2012 at 12:27 PM, Ali Torkamani wrote:
> Thanks, I checked, FD is not empty,
> Thanks for remind
I could resolve it by defining a small function:
def getValue(mydict,keys):
A=[];
for i in keys:
A=A+[mydict[i]]
return A
and then calling it: D=getValue(prog,sCommonFeatures);
(instead of D=[prog[key1] for key1 in list(sCommonFeatures)];)
but I'm still surprised why the latt
BTW I changed it to:
D=[prog[key1] for key1 in list(sCommonFeatures)]
because sCommonFeatures is actually a set, but it still has the smae problem
On Fri, Jul 6, 2012 at 12:27 PM, Ali Torkamani wrote:
> Thanks, I checked, FD is not empty,
> Thanks for reminding about the flush and close, but I
Thanks, I checked, FD is not empty,
Thanks for reminding about the flush and close, but I think some thing is
wrong with:
D=[prog[key1] for key1 in sCommonFeatures]
In the debug mode it works fine from the command line, but in the for loop
it gets stuck.
Ali
On Fri, Jul 6, 2012 at 12:22 PM, Pra
From: Ali Torkamani
> I'm trying to write a dictionary into a csv file, in the following code
> FlatData is the global dictionary whose keys are datetime objects, and the
> values are list of dictionaries. sCommonFeatures are key's that exist in all
> of such 'sub'-dictionaries, and sOtherFeatures
Dear Tutors,
I'm trying to write a dictionary into a csv file, in the following code
FlatData is the global dictionary whose keys are datetime objects, and the
values are list of dictionaries. sCommonFeatures are key's that exist in
all of such 'sub'-dictionaries, and sOtherFeatures are the key's t
17 matches
Mail list logo