An Apprentice Experiment in Python Programming, Part 4 2021-08-31T07:56:04.711Z
An Apprentice Experiment in Python Programming, Part 3 2021-08-16T04:42:31.948Z
An Apprentice Experiment in Python Programming, Part 2 2021-07-29T07:39:47.468Z
An Apprentice Experiment in Python Programming 2021-07-04T03:29:13.251Z
Should I take glucosamine? 2020-12-02T05:20:04.734Z
Charting Is Mostly Superstition 2020-08-23T20:26:15.474Z
Market Misconceptions 2020-08-20T04:46:21.991Z
The Wrong Side of Risk 2020-08-16T03:50:03.900Z
How to Lose a Fair Game 2020-08-14T18:41:13.638Z
Repeat Until Broke 2020-08-13T07:19:30.156Z
You Need More Money 2020-08-12T06:16:09.827Z
When is the right time to hole up? 2020-03-14T21:42:39.523Z
Do 24-hour hand sanitizers actually work? 2020-03-01T20:41:43.288Z
gilch's Shortform 2019-08-26T01:50:09.933Z
Stupid Questions June 2017 2017-06-10T18:32:57.352Z
Stupid Questions May 2017 2017-04-25T20:28:53.797Z
Open thread, Apr. 24 - Apr. 30, 2017 2017-04-24T19:43:36.697Z
Open thread, Apr. 17 - Apr. 23, 2017 2017-04-18T02:47:46.389Z
Cheating Omega 2017-04-13T03:39:10.943Z


Comment by gilch on Covid 9/23: There Is a War · 2021-09-26T05:52:19.750Z · LW · GW

I have no moral concerns about consuming limited doses for boosters when many haven't even had their first shot yet, especially if you have health issues. This is not zero-sum. More doses can be manufactured. Supply is not the main issue anymore. There are other problems stopping people from getting first doses that are mostly beyond your control. I do have some moral concerns about lying to get a treatment that is not authorized, but it may be the lesser of evils given your situation.

I have heard concerns about developing immunity to the adenovirus vector itself, eventually making boosters ineffective as well as limiting the use of said vector for future vaccines and gene therapy. There's also a risk that one has been exposed to the natural virus already, making the initial dose less effective. If J&J is your only option, that shouldn't stop you, but it's not. The Pfizer and Moderna shots don't have this issue since they're delivered by a lipid nanoparticles instead.

There's no obvious functional difference between the Pfizer and Moderna versions. They work on the same principles: mRNA (coding for the spike protein) in a lipid vehicle. They were tested with differing dosing and schedules, have slightly different formulations, and different branding.

Moderna's dose size is probably a little too high so it causes more severe side effects. But given the higher contagiousness of the now-prevalent Delta variant, a stronger reaction is probably a sign of better protection.

There is no plausible scientific reason (that I've heard of) not to boost with one of these two, regardless of what you started with (especially J&J, since it's weaker), but the FDA is only authorizing regimens that have been tested to their satisfaction, and considering the expense of clinical trials, the pharmaceutical companies might not get around to testing mixed regimens with their competitors for a while, if at all.

I'm less certain about the rest of this comment.

The timing of the booster matters. Getting it a day after your second dose probably won't do much. But if it's six months after, it should have a stronger effect. But you might get infected in those six months. I don't know what to recommend here.

I think that risks from the disease far outweigh the risks from the vaccine, even factoring in a 100% chance of getting a booster and only a 5% chance of getting the disease. Long COVID seems to happen sometimes even for mild infections, but perhaps unusual health conditions could change the calculation. Risks from the vaccine seem really overblown, and I don't think a booster changes that.

Comment by gilch on How should dance venues best protect the drinks of attendees? · 2021-09-21T04:24:29.523Z · LW · GW

Ban drinks on the floor and have gatekeepers guarding the exits to the bar. Train them to screen everyone leaving for symptoms of the date-rape drugs. (Are they fast-acting enough that this could be noticeable before they exit?) Announce and post signs so patrons expect this. Maybe train the bartenders too. Also don't give anyone more drinks if they're getting drunk. Maybe also screen everyone exiting the venue, if possible.

Comment by gilch on How should dance venues best protect the drinks of attendees? · 2021-09-21T04:09:12.434Z · LW · GW

I suppose the rapist could still palm an eyedropper and aim it into the straw, but this has got to be a lot more difficult than dropping a pinch of powder over an open cup. Doable, but difficult. Drops on the lid would be suspicious if he misses. Also, thin straws would make this even more difficult.

Comment by gilch on How should dance venues best protect the drinks of attendees? · 2021-09-21T04:01:38.463Z · LW · GW

Ban drinks on the floor, and only serve them in sex-segregated areas. Have bouncers to enforce this. (Bouncers and bartenders could still be male, but in uniform.) A rapist would have to have a female accomplice, successfully pose as a female (difficult for most men), steal a uniform, or actually be a female (this has got to be rare), and then still somehow get their mark out of the female area against her will without the bouncers noticing. This wouldn't stop the boys from getting raped, but I assume this is less of a problem?

Comment by gilch on How should dance venues best protect the drinks of attendees? · 2021-09-21T03:55:37.657Z · LW · GW

Have you considered banning the drinks altogether?

Comment by gilch on Ten Hundred Megaseconds · 2021-09-21T01:06:49.387Z · LW · GW

The objectively correct base is six.

Comment by gilch on Ten Hundred Megaseconds · 2021-09-20T21:50:42.258Z · LW · GW

I always thought a standard day would be a better base time than seconds. Human circadian rhythms can only be stretched so far.

Comment by gilch on How should dance venues best protect the drinks of attendees? · 2021-09-20T21:43:16.939Z · LW · GW

Also consider taping the lids on as a matter of course.

Comment by gilch on The Best Software For Every Need · 2021-09-20T21:23:06.657Z · LW · GW

I kind of like Xonsh, but that's because I'm used to Python. It still has some rough edges.

Comment by gilch on Core Pathways of Aging · 2021-09-19T05:43:20.986Z · LW · GW

Comment by gilch on Prefer the British Style of Quotation Mark Punctuation over the American · 2021-09-11T20:46:33.417Z · LW · GW

Despite being American, I'm also a programmer. I'm well aware of the American style, but choose not to use it. American style "looks better" arguably, only because we're used to it, but English style makes more sense, and is more consistent with how we punctuate around parentheses.

Comment by gilch on Open & Welcome Thread September 2021 · 2021-09-11T20:14:32.916Z · LW · GW

I'm not sure what to say besides "Bayesian thinking" here. This doesn't necessarily mean plugging in numbers (although that can help), but develop habits like not neglecting priors or base rates, considering how consistent the supposed evidence is with the converse of the hypotheses and so forth. I think normal, non-rationalist people reason in a Bayesian way at least some of the time. People mostly don't object to good epistemology, they just use a lot of bad epistemology too. Normal people understand words like "likely" or "uncertain". These are not alien concepts, just underutilized.

Comment by gilch on Open & Welcome Thread September 2021 · 2021-09-11T01:03:23.744Z · LW · GW

Can you short a crypto asset on DeFi without exposing yourself to unlimited risk? How can you trust a dapp isn't a scam, or buggy or insecure? Are there any trustworthy derivatives like futures or options?

Comment by gilch on Open & Welcome Thread September 2021 · 2021-09-10T04:45:41.422Z · LW · GW

Are you suggesting that beliefs must be binary? Either believed or not? E.g. if the probability of truth is over 50% then you believe it and don't believe if it's under 50%? Dispense with the binary and use the probability as your degree of belief. You can act with degrees of uncertainty. Hedge your bets, for example.

Comment by gilch on Open & Welcome Thread September 2021 · 2021-09-10T04:38:11.150Z · LW · GW

Posts are strong-upvoted by default and comments are not. I usually stick with the defaults. I have strong-upvoted my own comments, because this is allowed, but I do so pretty rarely, much less often than I strong-upvote comments from others. You don't get any extra Karma for it, and may get downvoted even more if people think the score is too high. I feel like I need a higher threshold for mine. Strong upvotes as a feature are valuable (in part) because they are optional and rare. I don't strong upvote because a comment was time consuming, for myself or others. I might if I think the comment is particularly valuable and wouldn't be noticed otherwise, or if I feel it was downvoted unfairly, to give others a chance to notice it and vote.

Comment by gilch on Open & Welcome Thread September 2021 · 2021-09-10T04:14:49.200Z · LW · GW

I've recently become interested in DeFi, but I'm not entirely sure where to start. What exactly have you been doing with it?

Comment by gilch on An Apprentice Experiment in Python Programming, Part 4 · 2021-09-01T17:55:03.141Z · LW · GW

Sounds like you're partway to updating for Python 3!

For the avoidance of doubt, the "obvious way" to do this (for an acculturated Python programmer) is with a nested def, which makes the progn thing non-obvious and therefore unpythonic. I strongly hinted at the obvious approach here, but konstell latched onto using a lambda instead (probably because she didn't realize that named functions could also be closures). I saw a teaching opportunity in this, so I rolled with it. I got to dispel the myth that lambdas can only have one line and also introduced assignment expressions. I was going to get around to the obvious way, but we ran out of time.

With progn and :=, it's possible to combine multiple statements into one, so effectively create a lambda with multiple statements.

konstell is using the terminology is a little imprecisely here. In Python, an "expression" evaluates to an object, while a "statement" is an instruction that does not evaluate to an object (not even None). Most statement types can contain expressions, however expressions cannot contain statements (exec() doesn't count).

One of the simplest types of statements in Python is the "expression statement", which contains a single expression and discards its result. A progn() expression can discard the results of subexpressions in a similar way, making them act like expression statements, but they are not technically Python statements. We also found an expression substitute for an assignment statement. It's ultimately possible to use expressions for everything you'd normally use statements for, but this is not the "obvious way" to do it.

See my Drython and Hissp projects for more on "onlinerizing" Python.

Comment by gilch on Reasonable ways for an average LW retail investor to get upside risk? · 2021-08-28T20:51:19.967Z · LW · GW

I recently stumbled across Taleb's barbell strategy. His thesis is that due to unknown unknowns (black swans), trying to manage a portfolio of (supposed) medium-risk investments is pointless; their true risk is impossible to compute, so you can't tell if you're overbetting or being compensated well. You can be ruined by a miscalculation. Instead, one should invest in a linear combination of extremely safe and extremely risky bets, which are both easier to quantify, to achieve a net medium-risk portfolio. You insulate yourself from the rare risks and expose yourself to the rare benefits, while avoiding the dangerous darkness of the middle ground.

A barbell portfolio might keep 90% of in conservative low-risk investments designed only to preserve capital and use the remaining 10% on speculative bets, which usually fail but occasionally pay off big.

The conservative side might be things like FDIC-insured American savings accounts, Swiss bank accounts, short-term treasuries/T-bills, short-term TIPS, and maybe a basket of precious metals.

The speculative side might be things like index put LEAPS, cryptocurrency, memestonks (sic), biotech startups, etc.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 3 · 2021-08-28T19:43:38.972Z · LW · GW

Knowing how to sugar and desugar the syntax is fundamentally all there is to know about decorators per se. But to use them well, one has to know a lot more Python than that. Everything else I'm teaching konstell could be done without the sugar, but decorators are a convenient focus for now.

Comment by gilch on Living with a homeopath - how? · 2021-08-26T06:19:35.119Z · LW · GW

When fighting against a tug-of-war (between scientific and "alternative" medicine, say) in a high-dimensional space, the best strategy is to pull sideways.

Fortunately, homeopathy is mostly harmless—a wonderful improvement over the usually actively-harmful "medicine" of its day, which is why it gained enough of a following to kind of get grandfathered in to our current system. So you probably have some time. If you're not a minor, you have the absolute right to refuse your mother's "treatments". It sounds like it's for your own good in her mind, so she won't disown you over this. If you are a minor, it's probably not going to kill you, but you can still fight it and maybe consider early emancipation.

But the level of insanity required to believe in this stuff is also sufficient to persuade people to drink bleach and die, or donate all of their money to Nigerian "princes"—a very dangerous place to be in the Internet age. Homeopathy is only a symptom. The real disease is faulty epistemology. It's endemic, but some people have a worse case than others.

Irrational people develop defenses against direct arguments, but you can often work around these using the Socratic method.

Street Epistemology is a modern method of Socratic dialogue focused on improving the interlocutor's epistemology, guiding them to eventually doubt and release their attachment to false beliefs. For someone in your position, it's worth learning to do. You may want to practice with others before trying it on your mother though.

Comment by gilch on gilch's Shortform · 2021-08-26T05:49:20.366Z · LW · GW

I currently have a small percentage of my portfolio in Ethereum. I'm considering making it a large percentage, maybe 20%, due to the Squish Chaos report. It was mentioned here on LW earlier, but didn't generate much discussion. Squish claims to be about 90% in Ether. The case seems compelling: Ether price could easily go up 7x on fundamentals and maybe 50x in the short term, probably within a year, at least according to the report. If true, this is an amazing opportunity, similar to being a Bitcoin early adopter, but the case seems too one-sided. I'm detecting a whiff of greed and groupthink from some other traders I've been discussing this with.

He who knows only his own side of the case, knows little of that. His reasons may be good, and no one may have been able to refute them. But if he is equally unable to refute the reasons on the opposite side; if he does not so much as know what they are, he has no ground for preferring either opinion. —J.S. Mill

So can someone please talk me out of it?

My best counter-case so far: Ether is extremely volatile and has dropped 90% before. (But eventually recovered.) Crypto is very over-hyped generally. (But this report seems unusually well-researched.) If I took every crypto bet that seemed good, I'd quickly lose my shirt. (But I rarely make bets this size. Even if I'm wrong, I'd probably recover from an ~18% loss within a year from my other investments.) By the EMH, if the future price is known, it should cost that much already, sans the risk-free rate and premium for risk. (But crypto markets are clearly not efficient yet, Squish makes a case why this can't be priced in yet.) Any time there's an Ethereum software update, we risk a hack. (The risk is still worth it, and another update could reverse losses, cf Ethereum Classic origin.) Ethereum is a bubble/ponzi scheme that could collapse at any moment. (Ethereum might have a better case on fundamentals that Bitcoin. Since Bretton Woods, fiat is also ponzi-like, yet stable enough due to policy. Squish suggests that Ether should be worth 7x current value on fundamentals alone.) The fundamental valuation is circular: smart contracts are only useful for making more kinds of tokens. (Even assuming 0 fundamental value, current prices are much higher than 0 now. Canada already has an ETF for Ether, the US will probably follow suit.)

Comment by gilch on Is top-down veganism unethical? · 2021-08-22T17:23:52.674Z · LW · GW


Comment by gilch on Open and Welcome Thread – August 2021 · 2021-08-22T04:54:29.054Z · LW · GW

Maybe if we could give a human more (emulated) cortical columns without also making him insane in the process, we'd end up with a limited superintelligence who maybe isn't completely Friendly, but also isn't completely alien to human values. If we just start with the computer, all bets are off. He might still go insane later though. Arms race scenarios are still a concern. Reckless approaches might make hybrid intelligence sooner, but they'd also be less stable. The end result of most unfriendly AIs is that all the humans are dead. It takes a perverse kind of near-miss to get to the hellish, worse-than-death scenarios. An unFriendly AI that doesn't just kill us. A crazy hybrid might be that.

If the smartest of humans could be made just a little smarter, maybe we could solve the alignment problem before AI goes FOOM. Otherwise, the next best approach seems to involve somehow getting the AI to solve the problem for us, without killing everyone (or worse) in the meantime. Of course, that's only if they're working on alignment, and not just improving AI.

If the Borg Collective becomes the next Facebook, then at least we're not all dead. Unfortunately, an AI trying to FOOM on a pure machine substrate would still outcompete us poor meat brains.

Comment by gilch on A Better Web is Coming · 2021-08-21T23:02:32.796Z · LW · GW

So Wust is only an idea from a paper, it's not a website you can use now?

I did find this:

It looks like an attempt at implementation, but I'm not sure how complete it is. Felix Dietze, the author of the paper, is one of the main contributors.

They also linked to related projects.

Arbital was an attempt at something similar. Not sure where that one's going.

Comment by gilch on When Programmers Don't Understand Code, Don't Blame The User · 2021-08-19T02:03:21.612Z · LW · GW

In this example, I blame the design of JavaScript. It's certainly possible to write bad code in any language, but I take exception to the gratuitous footguns.

I do value readability highly. Code is for humans, not just machines, or we'd still be writing programs in binary.

On the other hand, there really are basic things that you are supposed to know. Not being allowed to use them might make your code more comprehensible to a beginner, but it will also make too much code. You shouldn't have to reinvent the standard library.

There are certain elegant concepts like sets, or monads, or recursion, which a beginner might struggle with, but working around not having them when you need them probably isn't worth it.

Comment by gilch on In Most Markets, Lower Risk Means Higher Reward · 2021-08-18T06:56:45.569Z · LW · GW

Suppose I offer you two games:
A) You put up ten dollars. I flip a fair coin. Heads, I give it back and pay you one cent. Tails, I keep it all.
B) You put up $100,000. I flip a fair coin. Heads, I give it back and pay you $100. Tails, I keep it all.
You have the edge, right? Which bet is riskier? The only difference is scale.

What if we iterate? With game A, we trade some tens back and forth, but you accumulate one cent per head. It's a great deal. With game B, I'll probably have to put up some Benjamins, but eventually I'll get a streak of enough tails to wipe you out. Then I keep your money because you can't ante up.

The theoretically optimal investing strategy is Kelly, which accounts for this effect. The amount to invest is a function of your payoff distribution and the current size of your bankroll. Your bankroll size is known, but the payoff distribution is more difficult to calibrate. We could start with the past distribution of returns from the asset. Most of the time this looks like a modified normal distribution with much more kurtosis and negative skew.

The size of your risk isn't the number of dollars you have invested. It's how much you stand to lose and with what probability.

Volatility is much more predictable in practice than price. One can forecast it with much better accuracy than chance using e.g. a GARCH model.

Given these parameters, you can adjust your bet size for the forecast variance from your volatility model.

So volatility is most of what you need to know. There's still some black swan risk unaccounted for. Outliers that are both extreme and rare might not have had time to show up in your past distribution data. But in practice, you can cut off the tail risk using insurance like put options, which cost more the higher the forecast volatility is. So volatility is still the main parameter here.

Given this, for a given edge size, it makes sense to set the bet size based on forecast volatility and to pick assets based on the ratio of expected edge to forecast volatility. So something like a Sharpe ratio.

I have so far neglected the benefits of diversification. The noise for uncorrelated bets will tend to cancel out, i.e. reduce volatility. You can afford to take more risk on a bet, i.e. allocate more dollars to it, if you have other uncorrelated bets that can pay off and make up for your losses when you get unlucky.

Comment by gilch on Zen and Rationality: Equanimity · 2021-08-17T00:38:28.511Z · LW · GW

There's some tricky phrases in this litany that I don't quite endorse like "I desire to believe" and "beliefs I may not want"

Because Zen is about giving up attachment to desires, but epistemic rationality is about giving up attachment to beliefs? What wording could you endorse here instead?

The Litany of Tarski made quite an impression on me. It expressed something I had long considered important, but couldn't put my finger on. I've played around with variations of it, to try and make it more succinct without losing its spark, but "want" or "desire" have been in all my versions so far. If I try to express the point more directly, maybe it's something about (positively) "believing not-X" being distinct from "not believing X", plus an accurate belief being good (desirable) either way the world is. Moving the negation was important.

How do we talk about motivation and value judgement without them being fused to self and desire?

Comment by gilch on Obesity Epidemic Explained in 0.9 Subway Cookies · 2021-08-16T18:21:57.877Z · LW · GW

Agave syrup has a lower glycemic index (than sucrose), and it's marketed as a "health food" for this reason. But this is because it's mostly fructose, which has to be metabolized in the liver. So it doesn't cause the (maybe dangerous) blood sugar spikes, which means you also miss out on the satiety that would normally cause, and may thus overeat and get non-alcoholic fatty liver disease instead. Fructose is more intensely sweet than sucrose, so there is some additional concern that you could develop tolerance to the sweeter taste when it doesn't cause satiety and thus train yourself overeat food containing sucrose as well. If all these reasons are true, then agave is very bad for you, and possibly worse than glucose syrup or sucrose (which is a disaccharide molecule made of fructose bonded to glucose).

HFCS is not the same thing as corn syrup. Cornstarch is made into corn syrup by breaking down the starches into their component glucose molecules (originally using heat, pressure, and acid, but it's now mostly done with enzymes), thus corn syrup is mostly glucose and water. It's also the primary ingredient in Karo-brand syrup. Corn syrup is made into HFCS (high-fructose corn syrup) by enzymatically converting some portion of the glucose into fructose (commonly about half, to make it a substitute for sucrose), which gives it very different metabolic properties compared to the corn syrup it started from.

Comment by gilch on Perhaps vastly more people should be on FDA-approved weight loss medication · 2021-08-16T04:41:37.158Z · LW · GW

The safety information I had came from here.

RAND reviewed adverse events reported in 52 published randomized controlled clinical trials. No serious adverse events (death, myocardial infarction, cerebrovascular/stroke events, seizure, or serious psychiatric events) were reported in the clinical trials. However, evidence from the trials was sufficient to support the conclusion that the use of ephedrine, ephedrine plus caffeine, or ephedra plus caffeine is associated with 2-3 times the risk of nausea, vomiting, psychiatric symptoms such as anxiety and change in mood, autonomic hyperactivity, and palpitations. The contribution of caffeine to these symptoms cannot be determined.

There seems to be a disagreement in the literature about the facts. This one had randomized controlled trials. Maybe the sample size was too small though? In that case, are the "suggestions" of a safety problem enough to be a concern? How strong were these suggestions? Obesity also increases risk of death. Perhaps ECA still wins on net cost-benefit. Maybe the risks are very small. Death is a very serious side effect, to be taken very seriously, unfortunately, many over-the-counter medications we use routinely carry this risk. Degrees of risks matter. Maybe the ephedrine was correlated but wasn't the cause. We'd need the numbers, and maybe more statistical know-how than I've got.

Comment by gilch on A Response to A Contamination Theory of the Obesity Epidemic · 2021-08-16T02:56:11.376Z · LW · GW

it’s highly concentrated in processed junk that everyone agrees to avoid anyways.

One hypothesis I heard recently is that most natural whole foods are either high in both fiber and carbohydrates (vegetables), or in both fat and protein (animals), but the combination of fat+carbs without the fiber and protein is common in processed foods, which results in much less satiety per Calorie. The whole foods, on the other hand, are much harder to overeat. This explains why both low-carb and low-fat diets work: they both cut out the fat+carbs junk foods.

Butter your steak, not your potatoes?

So it may be the recent addition of cheap seed oils to our staple carbohydrates that explains most of our problem. That's just a hypothesis though. I really don't understand what's happening.

Comment by gilch on A Response to A Contamination Theory of the Obesity Epidemic · 2021-08-16T02:38:19.325Z · LW · GW

As for the other soy products, I have heard some concerns about the lectins, which are poisonous. Vegetables in general have toxins, which are usually there to protect them from insects. Humans, like most animals that eat plants, have adaptations to deal with this, so vegetables in general are not thought to be unhealthy, and probably not all of their effects are harmful, so I'm not sure what to make of this.

Most legumes, nuts, whole grains, and nightshades (e.g. tomatoes) contain a concerning amount of lectins, but cooking and fermentation can mostly break them down, and soaking and rinsing can also get rid of them. Most lectins break down with heat, but those found in peanuts and soybeans seem to be an exception, and might explain why allergies to these two foods are so common. Maybe some types of lectins are harmful and others are not, at natural doses.

Comment by gilch on A Response to A Contamination Theory of the Obesity Epidemic · 2021-08-16T02:26:24.415Z · LW · GW

I'm also suspicious of canola, but avocado and coconut oil have very different properties from soybean oil.

Canola is from recently developed cultivars of rapeseed, is high in pro-inflammatory omega-6 polyunsaturated fat, which also oxidizes (becomes rancid) more easily, and since canola is usually extracted with solvents and heat, it usually contains some amount of very unhealthy trans fats. This gets worse if you cook with it. If your only goal was to avoid saturated fats, then it sounds good on paper, but it's probably bad for you.

Sesame is a seed oil like canola. It's even higher in omega-6. Sesame oil tastes fine when cold-pressed, so trans fats would be less of a concern in that case. It's probably still bad for you overall.

Coconut oil is mostly saturated fat. It's resistant to oxidation, shouldn't contain trans fats, and is safe to fry with. Are saturated fats bad for you though? Some say so, but I'm not sure if I believe them.

Avocado oil is mostly monounsaturated fat, which isn't the supposedly unhealthy saturated fat, and is more resistant to oxidation and heat than polyunsaturated fat, though not as resistant as saturated fat. It should be safe too cook with as long as you're not using high heat. Its composition is actually really similar to olive oil. If you're going to add oil at all, avocado oil is probably one of the healthiest choices. Olive is good too for the same reasons, but it might have additional beneficial compounds when it's fresh.

Comment by gilch on Perhaps vastly more people should be on FDA-approved weight loss medication · 2021-08-15T02:30:11.254Z · LW · GW

Is that really how all of them work? In the case of ECA, I thought it was due to increased metabolism. But it might also have an effect on appetite.

And even when it is, is that good enough? It's possible for dietary changes to promote weight loss, but still be unhealthy. If you just eat junk food, and then the drugs reduce your appetite so you eat less food, but it's still junk food, then technically that's "dietary changes", but you're still not getting the micronutrients, fiber, prebiotics, and possibly bacteria that you would from fruits and vegetables. To the extent that the poor health is caused by excess Calories, it helps. But to the extent that poor health is caused by eating the wrong things, then simply eating less of them can only go so far.

Of course, I expect that using the prescription drugs as directed would be a last resort after dietary improvements prove insufficient, but doctors can only do so much to influence behavior.

Comment by gilch on Perhaps vastly more people should be on FDA-approved weight loss medication · 2021-08-14T19:48:37.923Z · LW · GW

I think metformin was supposed to have effects similar to caloric restriction, and does appear to reduce all-cause mortality, even though most users are diabetic.

Comment by gilch on Perhaps vastly more people should be on FDA-approved weight loss medication · 2021-08-14T19:24:50.714Z · LW · GW

the existence of effective anti-obesity medications is not particularly well-known

I had at least heard of the ECA stack (ephedrine, caffeine, and aspirin) before. It's available over-the-counter. The prescription meds were news to me though.

Is ECA effective? Yes. Bodybuilders are rumored to use it while cutting. Studies show you lose an extra two pounds per month. Is it safe? At reasonable dosage, yes, relatively. It's not going to kill you or cause psychosis, depression["serious psychiatric events"], or seizures [EDIT: see comments below], but side effects can be unpleasant, including nausea, vomiting, and anxiety, so the ephedrine is kinda restricted. You have to sign for it, and in some places the amount you can get per month is limited. I'm not desperate enough to try it yet, since fasting is keeping my weight under control so far.

the amount of life-years you can expect to gain over the long term by losing that much weight.

Do these drugs actually reduce all-cause mortality? Or are we just guessing based on a proxy measure? Is it the extra weight per se that causes the poor health or is the weight just an obvious side effect of some other underlying metabolic problem that the drugs are doing nothing to address? Inflammation? Insulin resistance? Micronutrients? Toxins? Gut flora imbalance? Fatty liver? Something else? Diet might fix these, while drugs might not.

Comment by gilch on A Response to A Contamination Theory of the Obesity Epidemic · 2021-08-14T04:07:11.344Z · LW · GW

I find the "Calories In, Calories Out" paradigm really exasperating. It may be technically correct, but it's a red herring, useless in practice, because it completely misses the real issue.

The body has a multitude of feedback mechanisms to maintain homeostasis. Weight is usually pretty stable. If you exert willpower to count calories and eat fewer of them, then the predictable response of the body is to reduce energy expenditure and to become hungrier. Neither is pleasant.

The mistaken mainstream scenario goes like this: You have sinned. You've been a glutton, but just a little bit. Occasionally, over the years, you've indulged yourself in the pleasures of eating and had just a bit too much. But a little here and a little there adds up over the decades and now you're definitely overweight!

Calories In, CaIories Out. But exercise seems to barely burn more than breathing, unless you're literally running marathons, so it's really just about Calories In.

So, if you want to lose the excess weight, then you simply have to Eat Fewer Calories. Ultimately, that's the only way any diet can work. So let's try the direct approach: fasting two days in a row per week will do it. (You can still have water, which has no Calories.) Couldn't be simpler. You exhaust your glycogen stores the first day, so your body has not choice but to switch to burning fat on the second. (Fasting for even longer periods works even better, but there are risks. 48 hours is perfectly safe unless you've got a weird medical issue. People do it religiously all the time.)

Continue until you're back to normal weight. Problem solved, right? Just do it again in a few decades when your gluttony catches up with you again. Right?

Except it doesn't work like that.

If you try this, and you're not already so overweight that you fail to sustain the program to hit your target, then when you stop you'll probably gain most of it back within a year. Not the decades it took you in the first place. If you're sufficiently overweight, then you'll lose some, but then gain enough of it back each week between fasts that you stop making progress.


Somehow the body's homeostasis program for weight got out of whack. That's the real issue. That's the part I'm interested in. Not the guilt/repentance cycle, because that never works. If things are working properly in the first place, then when you indulge, you have more energy and are less hungry. Homeostasis! For normal, healthy people, gaining weight seems to be as hard as losing it!

Why did the "set point" go up, permanently? Why don't you just get more fidgety and burn it off? Why don't you just get less hungry for your next meal? I don't fracking know.

There are a lot of interesting hypotheses. Maybe it's the fats. Skim the milk! Go vegan! Except whole milk works better for weight loss. Maybe it's the carbs. Atkins/Keto/Carnivore. /Paleo? No vegan! Maybe it's only both at once? Maybe it's the excess fructose building up fat in your liver. Maybe the antibiotics killed off an important strain in your gut flora, and no diet can work until you get it back. It's a ratchet. Maybe it's the emulsifiers emulsifying your gut lining, causing irritation. Maybe it's the omega-6, causing inflammation. Maybe it's just the ratio with the omega-3? Moar fish! Except mercury. Less fish! Maybe it's the high–glycemic index foods causing insulin spikes causing insulin resistance. Maybe it's the low–glycemic index foods not causing spikes not causing satiety. Maybe it's just not enough fiber. Moar beans. Grains must be made Whole. Maybe it's the lack of fiber that killed off the strain (and no diet can work until you get it back). Would fermented foods help? Some other probiotics? Which ones? Maybe it's mysterious chemicals in our packaging. Could be the plasticizers? Preservatives? Pesticides? Maybe it's the lectins. Beans are bawal. No moar beans. Grains are unWholy. Don't get me started on all the deadly nightshades. In fact, all the New World Plants are a Paradox. Unless you're Latino. GMOs are perfectly safe! Except they sometimes add pest-resistance, I mean "natural" pesticides, I mean lectins. Oops. Unless you cook them. Unless they're soybeans. Or peanuts. Other nuts must be roasted. Other gurus will be roasted too. Because they're nuts. It's a racket. And that A1-casein looks suspiciously lectin-like. You need special organic cows instead. Or switch to goat milk. It's the only way to be sure.

I am not making this up. I have evidence for all of this.

I notice I am Confused about this. No, I am very confused about this. So is everyone else. I think the global warming metaphor has thoroughly broken down. It's like when no-one knew what was causing scurvy and thought vitriolic elixir, vinegar, or seawater might help. We are that confused about this. No-one knows what the hell is going on, and even if they do, I've got ten more hypotheses that sound just as plausible. And have studies. That maybe haven't been replicated. Le sigh.

Comment by gilch on Obesity Epidemic Explained in 0.9 Subway Cookies · 2021-08-13T03:41:29.026Z · LW · GW

Especially avoid sugar/fructose.

Do you expect agave to be worse and glucose syrup (Karo) to be less bad as a sweetener than table sugar (sucrose) or high-fructose corn syrup?

Comment by gilch on Erratum for "From AI to Zombies" · 2021-08-12T07:27:52.862Z · LW · GW

A lot of the findings of the "soft" sciences, including psychology, didn't survive the replication crisis. There should be material for errata about that part by now.

I found much of the quantum physics sequence confusing, but Sean Carroll still makes a solid case for MWI.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-10T19:20:26.587Z · LW · GW

Looks like help() will fall back to reading a comment above a definition if it can't find a docstring, but only if it's in an accessible source file. Functions do know their line numbers for debugging purposes. If you try this with a definition in the REPL, or in an exec'd string or .pyc file (without corresponding source), this won't work, because there is no file to read the comments from, unlike a docstring which would be available at runtime when read from any of these sources.

Also, if you modify the source file after importing the object, then the line numbers won't match up and it might find the wrong comment (when it reads the modified source file to look for comments). This can't happen with docstrings either, since they're saved when the object is created.

See also inspect.getcomments().

Comment by gilch on Covid vaccine safety: how correct are these allegations? · 2021-08-10T04:50:17.396Z · LW · GW

I stumbled across the Better Skeptics "Ground Truth Challenge" which offered prize money for identifying false statements in this and three other related podcasts, judged by three referees including our own ciphergoth.

Results are here.

Comment by gilch on Covid vaccine safety: how correct are these allegations? · 2021-08-10T01:54:23.924Z · LW · GW

Yuri Deigin recently did a point-by-point takedown on Rebel Wisdom:

Bret's thesis rests on two pillars: the mRNA vaccines are dangerous and Ivermectin is a safer alternative. If either of these aren't true, then vaccination is the better option.

According to Yuri, basically all of the important claims are false. Neither pillar holds. The case on Dark Horse for the dangers of the vaccine and the safety and efficacy of Ivermectin is misleading at best. It requires cherry-picking studies of poor quality, and then misrepresenting what they actually say. Unless Yuri is outright making stuff up, I don't know what Bret is thinking. My estimation that Bret is being either rational or honest is diminishing.

I mentioned previously of conspiracy theorists that

They don't notice the inconsistencies in their own models, and their bald assertions often don't stand up to easy verification, if you bother to check.

Both Bret and Steve seem to show this failing now, and despite Bret's earlier record of scientific thinking and correct contrarianism, I think he's out of touch.

Comment by gilch on Covid vaccine safety: how correct are these allegations? · 2021-08-08T22:48:04.181Z · LW · GW

Sam Harris [who was also counted in the IDW originally] responded to this (as well as vaccine hesitancy in general) in a recent podcast

Sam's main point seems to be that even if we steelman the claims against the mRNA vaccines, it's still a clear-cut choice when you do a cost-benefit analysis because the risks from COVID are so much higher than from (mRNA) vaccines. But the vaccines are still obviously safe and effective and maybe Bret is confused. Also, Sam still considers Bret a friend.

DarkHorse Podcast reply:

Bret says that Sam failed to engage with his real arguments, and that past disputes of fact about this pandemic puts Bret in what we'd call the correct contrarian cluster, so take this a bit more seriously, please? Also, Bret still considers Sam a friend.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-08T04:23:29.998Z · LW · GW

functions that use variables that are in scope but don't get passed in as parameters

A function object combining both executable code and some variables from the surrounding lexical environment is called a lexical closure.

Different languages handle this kind of thing differently. Closures were motivated by lambda calculus, so they're a common feature of languages with higher-order functions. (Although lambda calculus itself has no such concept, it emerges naturally as an optimization when trying to write an efficient evaluator for it.)

Python added these with PEP 227 when it gained lexical scoping, years before I started using the language.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-06T04:40:01.040Z · LW · GW

The section "Branching without if" is a bit confusing, because it is unclear if those examples work or need more code.

The relevant context is the earlier definition of @if_.

def if_(condition):
    def decorator(c):
        if condition:
            return c.then()
            return c.else_()
    return decorator


def if_(condition):
    def decorator(c):
        return [c.then, c.else][not condition]()
    return decorator

would have the same behavior, and does not itself have an if statement. I've implemented if without using if.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-06T04:31:01.275Z · LW · GW

I asked gilch if it was possible to pipe outputs from python shell to bash tools, gilch answered that we could not do it directly

Maybe not entirely accurate as worded. I don't remember exactly how this part of the conversation went, but (for example)

>>> import os; from unittest.mock import patch
>>> with os.popen('less', 'w') as p, patch('sys.stdout.write', p.write):
...     copyright

would pop up less with the builtin copyright statement. Not as simple as the | in Bash. It might take me a while to explain how exactly how this works, but it's basically monkeypatching stdout to pipe to less. Redirecting outputs of the python shell is not the normal way of doing things. You can be more direct about it.

You can use bash to pipe things into or out of calls to Python (or both). Python can also use variations on popen to pipe to or from other utilities, although it's not nearly as easy as |.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-05T04:22:51.786Z · LW · GW

I can't reproduce the help(bob). Where is the # @wraps(function) coming from?

>>> def preprint(greetings): # factory
...     def greet_by_name(function): # decorator
...         def wrapper(): # replaces the function being decorated
...             print(greetings)
...             return function()
...         return wrapper
...     return greet_by_name
>>> @preprint("hi")
... def bob():
...     """
...     prints 'bob'
...     """
...     print("bob")
>>> help(bob)
Help on function wrapper in module __main__:

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-04T23:34:43.045Z · LW · GW

Is this still worth doing? Is the community getting anything out of these? The first post in this series has 39 voters so far. This one only has seven.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-04T17:32:30.559Z · LW · GW

Gilch illustrated the difference between a function and a callable

This part still seems confused. What you remember about this part isn't quite what I was trying to say. Functions are callables, but they're not the only type of callable. Classes are also callable, for example. Lambdas are of the function type in Python, so these aren't exactly separate categories.

>>> type(lambda:0)
<class 'function'>

Callables are anything you can call; they understand the function call operator. You can use the builtin predicate callable to tell if an object is callable or not.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-04T17:17:12.314Z · LW · GW

Re #2.

The multi-line lambda one always makes me want to facepalm. I hear it a lot, but this one is so confused that it's not even wrong.

First, lambdas in Python can have as many lines as you want. That makes the premise invalid. Seriously. My Hissp project is a Lisp compiler that targets a subset of Python. Its lambdas have the implicit PROGN typical of Lisp, and they compile to Python lambdas just fine. You could wrap your entire Hissp module in a progn and it will compile to a lambda expression that goes on for pages.

So why are people confused about this? I think they're conflating "lines of code" with "statements", which are not at all the same thing. It's true that certain kinds of Python statements typically fit on one line, but none of them have to, and many kinds (block statements, e.g. try-except/try-finally) typically don't.

So let's try to steelman this: even multi-line lambdas in Python can't directly contain statements. (Or, from a certain point of view, they contain only one: an implicit return. But they can call exec() on a string that does, or call other things that do.)

Second, true functional languages don't have statements to begin with, only expressions. (Or, from a certain point of view, they only have "expression statements".) Statements are a holdover from assembly, when the original Fortran mixed math expressions with machine code instructions (the "statements").

When programming in the functional style, which is when you want lambdas, you don't use statements anyway. Expressions are all you need! You don't even need a progn unless you have side effects, which is also not functional style.

So then the argument becomes "Python would not need decorators if anonymous functions could have statements."

Now what does the "need" part mean? Decorators are just syntactic sugar. You can get exactly the same behavior without them, so what use are decorators at all? Let's look at what the sugar does:

def <name>(<args>):

<name> = (<decorator expression>)(<name>)


@<decorator expression>
def <name>(<args>):

"Need" might be overstated. But why is the decorator better? The main reason is that it eliminates the duplication of <name>, which appears three times in the desugared version. It's also shorter and allows you to write the decorator expression before the function. Do lambdas have <name>s? No.

So what are they suggesting we could do instead? It's probably

<name> = (<decorator expression>)(
    lambda <args>:

which does already work in Python if <body> doesn't have statements (and it wouldn't in the functional style). But we're still missing the function's docstring, and its __name__ attribute will be '(lambda)' instead of <name>. Hypothetically, to fix these, it then becomes something like,

<name> = (<decorator expression>)(
    def <name>(<args>):

This doesn't work because def isn't an expression in Python. It's not about lambdas anymore.

Now the steelman argument has become "Python would not want decorators if function definitions were expressions."

But we can see that the decorator version is still better. It doesn't duplicate the <name>. It doesn't need another layer of indentation, which gets even worse when nesting these. Can we fix this? Maybe?

def defn(*decorators):
    def _(name, f):
        while decorators:
            f = decorators.pop()(f)
        globals()[name] = f
        f.__name__ = name  # etc.
    return _

defn(<decorator expression>)(
    "<name>", lambda <args>:

This only assigns to the top level because it uses globals, even if it's nested in a class or function. Perhaps if we had some kind of preprocessor macro that expanded to an assignment? But now we've just re-implemented decorators.

Comment by gilch on An Apprentice Experiment in Python Programming, Part 2 · 2021-08-04T08:09:00.756Z · LW · GW

Re #1.

Readability counts.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
—excerpts from The Zen of Python

This part of Python's culture was a reaction to Perl's motto, "There's more than one way to do it". Perl has been derided as a Write-only language, and despite its initial popularity, has been far eclipsed by Python. We can speculate about the various reasons, but I think this is one of them. Other ecosystems have their own cultures which emphasize different tradeoffs. Ruby, for example, seems to have inherited Perl's take.

The Zen is full of allusions and apparent contradictions. It's not meant to be obeyed as much as meditated upon; less about answers, and more about which questions to ask in the first place. So take my commentary as interpretation, not law.

Among other things, this part of The Zen is pointing out that code is read more often than it is written. It's more important to make code easy to read than easy to write. It's possible to write bad code in any language, but "bad" is partly a cultural interpretation. (And partly not.)

In Python, in the interest of readability, one should first do things in the most obvious way, until one has very good reason to do otherwise.

But "obvious" is also cultural. What is idiomatic in C is not, in Python, idiomatic (or "pythonic"), the "Dutch" part alluding to Guido van Rossum, the creator of Python, who made a lot of judgement calls about how Python was going to be, and what counts as "normal".

So "obvious" here means "obvious to acculturated Python programmers". It's a warning about being "too clever", and thereby being obtuse. But clever is OK when it's easy to read! Are you trying to show off or are you trying to write good code? If you are an acculturated Python programmer, then you can judge what's obvious and isn't. But culture isn't a static thing. If you're a part of it, and you know better, you can push boundaries a little.

(To read all of The Zen, import this.)

My exercises for konstell are not necessarily pythonic. They illustrate particular points I was trying to teach; weaknesses I noticed in her understanding at the time. That you can do something doesn't mean you should.

So, like anything else in Python, my main heuristic would be, does your decorator make the code easier or harder to read, for an acculturated Python programmer? Does it have benefits worth the costs? Decorators are a Python feature, and they're used a lot. Excessive length is bad for readability too, and often neglected. Being more concise can be worth being slightly less obvious. Does it make tooling easier or harder to use? Does it make testing more or less difficult?