#python - Thu 8 Mar 2007 between 00:00 and 00:09

haysbut days is a heap
LeedsHKwtf is a heap?
squiglyI was planing to say here is the python tutorial, here is the thinking in python, make some thing does some thing.
ironfroggyno one ever uses heapq
TFKylethat works
squiglyI think most of my libraries arnt especially useful to learn with
triplah_wit doesnt look like you need a heap
TFKylesquigly: he doesn't know python at all?
arkanesI don't see any usage of the heap propery there
triplah_whays: let me just say, that's a very haskellish way of approaching it hehe
hayswell the file dates are in reverse order, but I assumed that they might not be in order
arkaneshays: you can sort lists without making them heaps
haysbut inside the heap is actually more useful
ironfroggyyeah just read the list and then sort it
hayssure but inside I actually use a heap
triplah_winside what?
haysbecause I need to sell all positions which have made 6%
triplah_wyou dont need the heap.... is there a clear reason why you are using it?
squiglyTFKyle, no she doesnt
haysfor day in sort(days)?
squiglybut i dont hold that against them
arkanesa tuple rather than a list for the linelist would be slightly more idiomatic
as well as unpacking rather than indexing
haysarkanes: how do I make a tuple?
I only know about split
arkanesits really more of a datafile problem
and actually since you have to split() it, may as well leave it as a list
ironfroggyi wouldnt worry about that, split returns a list, so just use it.
but unpacking is definately a good idea
arkanesIn general, I find indexing in python to be a smell
hays: python can unpack sequences into variables
a,b,c = (1,2,3)
sets a=1 and so on
hays: even if you decide to keep the heap, you can just use while days: and while shares: without the explit test
the empty list is False in a boolean context
haystoo many values to unpack.. hmm
arkanesthe variables need to match the sequence
if you only want, say, the first 3 of an abritrary length, you can slice the seqence

Page: 2 9 16 23 30 37 44 51 58 65 72 79