« first day (5516 days earlier)   

00:07
@xjcl: `"a" in "b" is False`
Yes, x not in list/tuple/dict/set is more straightforward. Here's an existing SO question:
483
Q: Check if something is (not) in a list in Python

ZackI have a list of tuples in Python, and I have a conditional where I want to take the branch ONLY if the tuple is not in the list (if it is in the list, then I don't want to take the if branch) if curr_x -1 > 0 and (curr_x-1 , curr_y) not in myList: # Do Something This is not really worki...

 
9 hours later…
09:25
What do we say to the God of Death? "Not today!" I'm so glad I started printing stuff out before I fell into this trap with Decimal division by my very attempt to stop floating point errors.
Oh gosh. I recently pondered significant digits for some system sensor here and just gave up after a half an hour of discovering gotchas...
The problem I have now is knowing what to do with Decimal('0.00001023405278724427660597873364'). That comes from the division of two DB columns stored as NUMERIC(24, 12) in SQLAlchemy. It looks like if I quantize that back to 12 d.p. I could potentially be losing a lot of precision, but I don't know how much of that figure is really necessary
.quantize(..., context=Context(traps=[Inexact])) is a bjooteefull API, by the way.
@roganjosh Well, do you actually have that precision in the first place? It's probably worth looking/estimating how precise the initial values are and then ballparking error propagation on it. Number of digits is usually just a very conservative upper bound on the precision.
My name is MisterMiyagi and I store values with less than ten significant binary digits in 64b floats. takes a seat, sips cheap coffee
I have one guiding principle, that I might need to take a truck delivery of 50 tonnes of sugar to a sweet factory and I need to divide that down to the fraction of a truckload that goes into a single sweet. It's the flimsiest of flimsy anecdotes I have to go on, but god knows what other clients might throw at the system
Knowing todays sweets, you can probably get away with integer math on that one.
09:40
I think I'll go back to NUMERIC(36, 18) instead. That Decimal value scares me
@MisterMiyagi But what if I need to calculate the proportion of crisps to air in a crisp packet? I'd need vanishing small values for the crisps!
That's a challenge. Perhaps a mainframe has enough memory to store all the required digits. :/
10:04
I suppose I could just not store the conversion at all in the DB and just calculate it on-the-fly but that seems unnecessarily heavy. Bleugh, this was supposed to be the easy part :(
 
4 hours later…
13:36
@Aran-Fey: Shush! Let me sweep this under the rug in peace!
If it makes you feel better, I've spent the last hour tracking down why I'm out by an order of magnitude on one of my calcs. Turns out, I decided there were 10,000 ml in a litre when I wrote my base JSON that bootstraps my database.

« first day (5516 days earlier)