Better HN
topnewbestaskshowjobs
Log inSign up

kortex

8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions

Submissions

comment 3y ago · link · parent

Tabs are absolutely a valid criticism. I can't tell you how many times the editor I'm using put in 4 spaces instead of a proper tab.

.PHONY is truly a bizarre construction. There's nothing like it in modern code systems. It's only by familiarity with make that it gains some semblance of normalcy.

comment 3y ago · link · parent

The flip side of that is people who can keep everything in their head often write code which reflects exactly that, and that code is very hard for others to scrutinize.

I try to lean into just such a silver lining. I like to write my code for worst-case future-me: what would it take for my sleep-deprived, Monday morning, uncaffeinated brain to make sense of? It definitely helps, especially even considering that approach, I often find I overestimate my future ability to understand past code.

comment 3y ago · link · parent

> Why does every feature of every living thing have to have an evolutionary explanation?

This phrasing implies the premise is true, which I don't agree with, so I am going to tackle 3 related questions:

- Why does /any phenomenon/ require explanation?

Because we are curious, and want to know how and why things do what they do. Answers lead to more questions, to more answers, in a loop of learning

- Why do all biological phenomena need an evolutionary explanation?

Because outside of artificial selection, natural selection is the only causal mechanism (outside of pure chance). Mitosis, Miosis, and Mutation are the building blocks.

But much of that boils down to, "why is x the way it is? Because chance". which is not very interesting, which leads to...

- Why does bee sting suicide in particular warrant an explanation?

Because under a naive understanding of evolution, it is a paradox. Also, there was a time when proto-hymenoptera were not eusocial, so how did they become eusocial? Those are really interesting problems to look at.

You are right in pointing out that pop-sci evolutionary handwavy explanations are a problem. But I don't think that is common in the broad science in biology.

comment 3y ago · link · parent

Huh, TIL that childbirth was likely challenging for other smaller-head hominids, not just big-brain Sapiens.

Walking upright is still the strongest hypothesis for the difficult birth process.

https://scitechdaily.com/scientists-have-figured-out-why-chi...

comment 3y ago · link · parent

I really hope a solution can be found and python can get true lazy imports (without doing the manual thing). I work in the ML/AI space and manual lazy imports are basically mandatory unless you want several seconds to see usage text from `footool --help`. Why "pay" for executing code you don't use?

Manual lazy import meaning:

    def uses_foo(x):
        import foo
        return foo.bar(x)
Manual lazy import sucks because:

- it's just ugly, I like imports all at the top so I can see all the deps

- bad for static analysis

- performance hit every time the function is called

Eschewing lazy imports has several problems:

- you always pay the execution cost, even if you don't use it

- also bad for static analysis and testing, since you have to eat the import time even if the code block you want to test doesn't execute the expensive path

- sometimes you need lazy import to avoid circular import errors

It's too bad that the main impediment to this is existing code which relies on side effects. Import-time side effects are an absolute pain in the ass. Avoid it at all costs.

comment 3y ago · link · parent

It's hugely different. The issue occurs when you have something which does not need to execute in every context. Let's day you have a CLI which does some machine learning with several models. You don't want to execute loading every model every time you start the app.

The most egregious is when you just want to display the help/usage text and not actually execute any code at all. Instead, you have to either manually lazy import (what I usually do now), or eat huge startup costs each time you screw up the command syntax.

comment 3y ago · link · parent

It's not necessarily the teacher's fault. They could be perfectly adequate (not extremely boring as a baseline), but you have students that may have ADHD, ODD, etc, and just the temptation knowing the hidden game is there is enough to jack up the excitement level of an otherwise rather boring game enough to detract from classes.

comment 3y ago · link · parent

Self-loading code is a huge part of the value-add of python libraries. Many of the popular libraries (e.g. Numpy and friends) trigger a bewildering chain of events to compile from source if not installing from pre-built wheels. And if you do have wheels, you have opaque binary blobs. So pick your poison: compile-on-install with possible backdoor or prebuilt .so/.dylib/.pyc with possible backdoor.

The most obvious (but not necessarily easiest) approach is to phase out setup.py and move everything to the declarative pyproject.toml approach. This is not just better for metadata (setup scripts make it really hard to statically infer what deps a lib has), it also allows for better control over what installers/toolchains run on install.

Attackers still have quite a lot of latitude during the build phase, but at least libraries have the option to specify declaratively what permissions they need (and presumably the user has the option to forbid them).

Also eval/exec are terrible and I wish there were a mode to disable their usage, but I don't know if the python runtime has some deep dependency on it. Maybe there's a way to restrict it so that only low level frames can call the eval opcode.

comment 3y ago · link · parent

I thought it was interesting. I've never heard of some of these techniques.

comment 3y ago · link · parent

Gemany^W Allemagne^W Tyskland^W Saksa^W Németország^W Deutschland would like a word.

comment 3y ago · link · parent

> avoids acknowledging that Spain was once a world power

As opposed to... checks notes the Holy Roman Empire?

> (2) intentionally introduces an unwanted misspelling of a common Spanish word that accentuates the Castilian lisp

That's just how the linguistics do. This is the same drivel that tries to argue chop chop and long time no see are somehow offensive, instead of just loanphrases from Chinese pidjin.

> (3) intentionally misgenders the vast majority of people from those regions

No, again this demonstrates a profound ignorance of how language actually works in practice. -o does not imply "default male" in Spanish. There's tomes on this stuff. Grammatical gender is not social gender. A mesa doesn't identify as female.

> (4) denies the existence of non-European South American languages and cultures.

Again, Latin/[aoex]?/ is better in this regard how exactly?

comment 3y ago · link · parent

"-shima" is just 島 'island'. See also Ōshima, Mishima, Fujishima, Furushima, Hiroshima, and even Iwo Jima (硫黄島, "Shima" is sometimes pronounced "Jima" in Japanese for some reason).

Note that Fukushima isn't a "true" island, though some think it might come from a block of land isolated by rivers.

comment 3y ago · link · parent

Cost aside, it is possible to calcine limestone with green electricity, and capture the outbound CO2.

As mentioned, this is still quite costly, but it's likely a hurdle we will need to cross regardless to get to green cement.

comment 3y ago · link · parent

> I presume it is possible for these industrial uses to cause significant pollution, but you mean that it is not difficult to prevent pollution from these processes because they happen in controlled locations?

Fluoropolymers don't really leach in significant quantities on commercial timescales. That would sort of defeat their purpose of being inert. So there is a huge difference between "these teflon o-rings in this chemical plant leach 0.1 ppb of small molecule PFAS per day" and "millions of teflon pans go into the landfill each year". And further still to "we produce railcars worth of volatile fluoropolymer monomers for producing teflon and viton".

> I believe a lot of PFAS contamination comes from the production process itself.

This exactly. Low-molecular-weight PFAS are much more mobile than high weight, thus more polluting. Once "bound" in a polymer, the leaching is minimal. The problem is the production process, where you have primarily the small molecules, which inevitably get into the environment.

comment 3y ago · link · parent

> About a quarter of new pharmaceuticals are PFAS

Huh, TIL. I was going to rebut this but I looked into it. I didn't realize simply the presence of a -CF3 group is enough to classify the whole molecule as a PFAS according to new definitions.

> More recently (2021) the Organisation for Economic Co-operation and Development (OECD) expanded the definition, stating that "PFASs are defined as fluorinated substances that contain at least one fully fluorinated methyl or methylene carbon atom (without any H/Cl/Br/I atom attached to it), i.e. with a few noted exceptions, any chemical with at least a perfluorinated methyl group (–CF3) or a perfluorinated methylene group (–CF2–) is a PFAS."[3][4]

That's a super popular moeity in medchem for whatever reason, so yeah, RIP all thing trifluoromethyl.

Difluromethylene can be degraded much more quickly as long as the molecule can be "unzipped" (needs a break point where nucleophilic attack can occur), so it's possible we may be able to sub in -CHF2 or -CH2F to "cap" molecules and render them less persistent.

comment 3y ago · link · parent

Would love to see a straw poll of what these lawmakers consider "tools not normally found in a residence". Oscilloscope? Not "normally" found in a residence (I would say <10% of households have one). Can be used to study engine timing (exactly what I'm doing at the moment to fix my ride-on). In my humble garage shop, I also have, lets see... OBD2 reader, specialty 12-point driver bits, a precision lab scale, a bunch of old Starrett metrology tools, oxymap torch, HHO gas generator, etc., are those normally found in a residence?

These "I know it when I see it" kinds of laws are terrible.

comment 3y ago · link · parent

That's no excuse for obnoxiously vague laws. Let's say, hypothetically, the premise of "save the environment" is valid. Instead of banning "tools not commonly found in the residence", which is completely open to interpretation, you could specifically ban refrigeration evacuation equipment.

This is still bad (as it singles out HVAC repair folks), but it's worlds better than letting enforcers arbitrarily decide whether a vacuum pump, security torx set, tachometer, or ignition tester is verboten.

Also, oil changes are specifically allowed, and they are one of the primary causes of pollution from home car tinkerers.

comment 3y ago · link · parent

"Latine" (with a long e) or just "Latin" works fairly well in the language if one absolutely must avoid the collective-o ending, as in "Latine intelligente." Still a tad awkward, but leagues better than "Latinx", which is such a blatant violation of Spanish phonotactics and aesthetics that it bugs me, a white AF grigo.

"Latinx" was so obviously created by an English-primary speaker.

comment 3y ago · link · parent

Sorry, "woke" is ableist and biased against folks living with narcolepsy, sleep apnea, and other sleep disorders^W abnormalities^W^W somnodivergence.

comment 3y ago · link · parent

> Meaning of the song "Weapon of Choice" by Fatboy Slim (Ft. Bootsy Collins)

    The song "Weapon of Choice" by Fatboy Slim featuring Bootsy Collins is about personal empowerment and strength. The song encourages the listener to find their own individual weapon of choice—that is, whatever resource they find to fight their inner battles and make their way in life—rather than relying on provocation and violence. The song also encourages self-reflection and awareness of the struggles of those around us, and reminds the listener to be careful in challenging situations and to watch out for those they don't know. Ultimately, the song is a passionate and empowering anthem that encourages standing up for one's own self-determination and respecting the journeys of others.
https://www.songtell.com/fatboy-slim-ft-bootsy-collins/weapo...

The lyrics are notably Dune references, which the bot completely misses. Not even mentioning the worm, which is one of the most prominent words. It seems like the interpretations fall into one of a few categories:

- Very well known songs with a large corpus of direct discussion on the lyrics, and basically just summarizing what people said (Bohemian Rhapsody)

- Songs with relatively straightforward meanings and it just summarizes directly from the lyrics (insert most pop songs)

- Songs that are too obscure to have widespread discussion but slightly opaque lyrics (Weapon of Choice, Clint Eastwood by Gorillaz)

- completely fabricating from insufficient data (Around the World by Daft Punk)

Still a really cool concept!

comment 3y ago · link · parent

But there's no information in the song lyrics to indicate that it's anything to do with LGBT. I have heard it on the radio for years and had no idea until I saw the music video. So I'm not sure I'd say that it's "missed" - I'd probably ascribe a similar meaning going off of just the lyrics.

On the other hand...this one was totally a swing and a miss.

https://www.songtell.com/g-nther/ding-dong-song

Edit: quoted cause server is getting overloaded:

> "Ding Dong Song" by Günther is a dance-pop love song about searching for love in the night. The chorus and verses repeat the phrase "you touch my tralala," which is a playful and affectionate way of expressing affection for someone. The song's title, "Ding Dong Song," refers to the phrase that is repeated in the chorus: "Mmm, my ding ding dong". This could be interpreted as a representation of the feeling of joy and excitement that comes with finding and expressing love for someone. The song is about the longing for a connection with a special person and the joy that comes from having that connection.

comment 3y ago · link · parent

The sea is a harsh mistress, but if anything is going to lend itself to seaworthiness, something solid state like solar panels makes a lot of sense. Especially if we can work out flexible/durable panels.

More sensitive electronics and the batteries can be put in sealed compartments.

comment 3y ago · link · parent

Agree on the points that you should never need to abstract over your database, orm, message queue, etc.

Disagree on dependency injection. I came from the globals/patch everything school of python, to the Fastapi/Pytest DI flavor, and it's a breath of fresh air. It's just so much easier to abstract the IO providers and swap them out with objects tailored to the test suite - eg for database, I create db objects which roll back any transactions between tests.

Hard disagree on unit tests. Maybe in other languages, but in Python, trying to develop even a moderately complex app without unit tests is a nightmare. I know, I've lived it. Even in an app with >85% unit test coverage, there was still a ton of friction around development on any of the interfaces which had low coverage.

Any gains in velocity of development almost always cost far more in debugging down the road.

I love python, but it is really prone to dumb footguns at runtime, NoneType errors in particular. You need to impose a lot of discipline to make large python apps enjoyable to develop on.

comment 3y ago · link · parent

This comment demonstrates a tremendous amount of naivete about the Cpython runtime. After PyObject itself, the GIL mutex is probably the next most important data structure in the entire codebase. It's not "someone not being bothered to write thread-safe software." It's not something you can hide behind a flag. It's central to the entire cpython data model and any library which relies on releasing the GIL.

The closest anyone has come to removing the GIL is the Gilectomy project by Larry Hastings, and it's unlikely to ever be upstreamed unless it could be somehow made to work with libraries that rely on assumptions about GIL mechanics (eg numpy).

comment 3y ago · link · parent

The GILectomy project was able to maintain thread safety on refcounting while (mostly) preserving performance by basically using some clever flags in the refcount to signal specific lifetimes/ownership (simplification for brevity). So you have good performance when the thread owns a reference while preserving safety for shared objects.

The smaller problem is this does at a small amount of overhead even to single-threaded performance. The gilectomy project improved performance elsewhere so net performance is close to the same.

The bigger problem would be integrating this strategy with all the libraries that rely on existing GIL behavior.

comment 3y ago · link · parent

> for quick light development using pure python I pip install directly into my user dir of my system python.

I'd advise against this habit, even for "light" development work. I've been bitten too many times by some library installing into the wrong env or picking up the wrong path of a library.

Conda's generally a good move if you don't want to manually manage virtualenvs.

comment 3y ago · link · parent

I understand your frustration, but the poetry team's response makes sense. The situation you got yourself is quite strange. System package python environments are notoriously nasty (frankly they were a mistake, but they emerged before venv, so it's hard to fault).

Non-PEP440 compliant libraries are also a pain in the ass.

Put both those facts together and you are playing with fire. In all likelihood you will eventually footgun yourself and end up with a python env superfund.

Just use virtual envs for everything.

I say this coming from over a decade of python experience and lots of time spent installing python in exotic environments.

comment 3y ago · link · parent

Absolutely. You should almost never be pip-installing global things (of course there are circumstances, but you should know exactly why you are choosing to do it, vs an env).

Vanilla pip works well with the venv module. I still manually manage the majority of my virtual environments, with the virtualenvwrapper libary, although `source path/to/myvenv/bin/activate` also works.

Pipx is great for installing executable tools.

comment 3y ago · link · parent

It almost always starts benign: keep the bins out of sight except for trash days. But sooner or later some power-hungry busybody takes over and the next thing you know, citations are flying left and right.

comment 3y ago · link · parent

Fire's natural state is burning only at standard temperature and pressure (or greater). If you look at the "average" state of all space in the universe, fire is not stable.
1
202122
85